sync.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:trough 作者: internetarchive 项目源码 文件源码
def bulk_heartbeat(self, ids):
        self.rethinker.table('services').get_all(*ids).update({ 'last_heartbeat': r.now(), 'load': os.getloadavg()[1] }).run()
        # send a non-bulk heartbeat for each id we *didn't* just update
        missing_ids = set(ids) - set(self.rethinker.table('services').get_all(*ids).get_field('id').run())
        for id in missing_ids:
            pool, node, segment = id.split(":")
            port = settings['WRITE_PORT'] if pool == 'trough-write' else settings['READ_PORT']
            url = 'http://%s:%s/?segment=%s' % (node, port, segment)
            self.heartbeat(pool=pool, node=node, segment=segment, port=port, url=url, ttl=round(settings['SYNC_LOOP_TIMING'] * 4))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号