You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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()
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: