def update_round(finished_round: int) -> None: new_round = finished_round + 1 set_round_start(r=new_round) update_real_round_in_db(new_round=new_round) with utils.redis_pipeline(transaction=False) as pipe: pipe.set(CacheKeys.current_round(), new_round) pipe.execute()
def get_real_round() -> int: """ Get real round of system (for flag submitting). :returns: -1 if round not in cache, else round """ with utils.redis_pipeline(transaction=False) as pipe: r, = pipe.get(CacheKeys.current_round()).execute() return int(r or -1)