Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Broken algorithm #15

@louisabraham

Description

@louisabraham

The algorithm will always wait too much.

import time
from ratelimiter import RateLimiter

rate_limiter = RateLimiter(max_calls=1, period=1)

start = time.time()
for i in range(3):
    with rate_limiter:
        print("%.02f" % (time.time()  - start))
        time.sleep(1)

outputs

0.00
2.00
4.01

I would expect it to output 0 1 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions