benchmark-api-heartbeat.py 文件源码

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

项目:aw-server 作者: ActivityWatch 项目源码 文件源码
def benchmark():
    ds = aw_datastore.Datastore(aw_datastore.storages.PeeweeStorage, testing=True)
    api = aw_server.api.ServerAPI(ds, testing=True)

    print(api.get_info())

    bucket_id = "test-benchmark"

    try:
        api.create_bucket(bucket_id, "test", "test", "test")
    except Exception as e:
        print(e)

    print("Benchmarking... this will take 30 seconds")
    for i in range(120):
        sleep(0.1)
        api.heartbeat(bucket_id, Event(timestamp=datetime.now(tz=tz.utc), data={"test": str(int(i))}), pulsetime=0.3)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号