()
Go through all recent requests and delete those that were too long ago.
Go through all recent requests and delete those that were too long ago.
Go through all recent requests and delete those that were too long ago .
def update_user_count() -> None:
    """Go through all recent requests and delete those that were too long ago."""
    now = time.time()
    last_requests = redis.get("last_requests")
    for key, value in list(last_requests.items()):
        if now - value >= INACTIVITY_PERIOD:
            del last_requests[key]
            redis.set("last_requests", last_requests)
    redis.set("last_user_count_update", now)
def update_user_count ( ) -> None : now = time . time ( ) last_requests = redis . get ( "last_requests" ) for key , value in list ( last_requests . items ( ) ) : if now - value >= INACTIVITY_PERIOD : del last_requests [ key ] redis . set ( "last_requests" , last_requests ) redis . set ( "last_user_count_update" , now )