Clémentine commited on
Commit
e5885b1
1 Parent(s): a39e583

add global calls for timers

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -92,6 +92,7 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3, ba
92
 
93
  def get_latest_data_leaderboard(init: bool = False):
94
  current_time = datetime.datetime.now()
 
95
  if current_time - LAST_UPDATE_LEADERBOARD < datetime.timedelta(minutes=10):
96
  return
97
  LAST_UPDATE_LEADERBOARD = current_time
@@ -368,6 +369,7 @@ async def update_queue(payload: WebhookPayload) -> None:
368
  """Redownloads the queue dataset each time it updates"""
369
  if payload.repo.type == "dataset" and payload.event.action == "update":
370
  current_time = datetime.datetime.now()
 
371
  if current_time - LAST_UPDATE_QUEUE > datetime.timedelta(minutes=10):
372
  print("would have updated")
373
  # We only redownload is last update was more than 10 minutes ago, as the queue is
 
92
 
93
  def get_latest_data_leaderboard(init: bool = False):
94
  current_time = datetime.datetime.now()
95
+ global LAST_UPDATE_LEADERBOARD
96
  if current_time - LAST_UPDATE_LEADERBOARD < datetime.timedelta(minutes=10):
97
  return
98
  LAST_UPDATE_LEADERBOARD = current_time
 
369
  """Redownloads the queue dataset each time it updates"""
370
  if payload.repo.type == "dataset" and payload.event.action == "update":
371
  current_time = datetime.datetime.now()
372
+ global LAST_UPDATE_QUEUE
373
  if current_time - LAST_UPDATE_QUEUE > datetime.timedelta(minutes=10):
374
  print("would have updated")
375
  # We only redownload is last update was more than 10 minutes ago, as the queue is