accounts.py 文件源码

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

项目:hivemind 作者: steemit 项目源码 文件源码
def cache_accounts(cls, accounts):
        from hive.indexer.cache import batch_queries

        processed = 0
        total = len(accounts)

        for i in range(0, total, 1000):
            batch = accounts[i:i+1000]

            lap_0 = time.perf_counter()
            sqls = cls._generate_cache_sqls(batch)
            lap_1 = time.perf_counter()
            batch_queries(sqls)
            lap_2 = time.perf_counter()

            if len(batch) < 1000:
                continue

            processed += len(batch)
            rem = total - processed
            rate = len(batch) / (lap_2 - lap_0)
            pct_db = int(100 * (lap_2 - lap_1) / (lap_2 - lap_0))
            print(" -- account {} of {} ({}/s, {}% db) -- {}m remaining".format(
                processed, total, round(rate, 1), pct_db, round(rem / rate / 60, 2)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号