-
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Hello, I'm trying to use jitter to add a randomness to the refresh rate a bit. I want to add a random amount of time between 1 and 20 seconds for the refresh rate but it doesn't seem to do anything.
from limiter import Limiter
from rich.console import Console
from datetime import datetime
REFRESH_RATE: int = 1
BURST_RATE: int = 1
MSG_BUCKET: str = 'messages'
limiter: Limiter = Limiter(rate=REFRESH_RATE, capacity=BURST_RATE)
limit_msgs: Limiter = limiter(bucket=MSG_BUCKET)
@limit_msgs(jitter=range(1000,20000))
def send_message(console, message):
msg = f"{datetime.now()} {message}"
console.print(f"Sending {msg}")
def main():
console = Console()
x = 1
while True:
msg = f"MSG {x}"
send_message(console, msg)
x += 1
if __name__ == "__main__":
main()
Metadata
Metadata
Assignees
Labels
No labels