Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mightqxc committed Jul 18, 2023
1 parent 6121a28 commit b7ad513
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pandaharvester/commit_timestamp.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
timestamp = "18-07-2023 14:09:07 on flin (by mightqxc)"
timestamp = "18-07-2023 14:50:29 on flin (by mightqxc)"
12 changes: 8 additions & 4 deletions pandaharvester/harvestercore/queue_config_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def __init__(self, update_db=True):
self.lock = threading.Lock()
self.lastUpdate = None
self.lastReload = None
self.lastCheck = None
self.dbProxy = DBProxy()
self.toUpdateDB = update_db
try:
Expand Down Expand Up @@ -290,10 +291,12 @@ def load_data(self, refill_table=False):
time_now = datetime.datetime.utcnow()
updateInterval_td = datetime.timedelta(seconds=self.updateInterval)
checkInterval_td = datetime.timedelta(seconds=self.checkInterval)
# skip if lastUpdate is fresh (within checkInterval)
if (self.lastUpdate is not None
and time_now - self.lastUpdate < checkInterval_td):
# skip if lastCheck is fresh (within checkInterval)
if (self.lastCheck is not None
and time_now - self.lastCheck < checkInterval_td):
self.lastCheck = time_now
return
self.lastCheck = time_now
# get last_reload_timestamp from DB
last_reload_timestamp = self._get_last_reload_time()
self.lastReload = None if last_reload_timestamp is None else datetime.datetime.utcfromtimestamp(last_reload_timestamp)
Expand Down Expand Up @@ -628,8 +631,9 @@ def load_data(self, refill_table=False):
queueConfig.configID = dumpSpec.configID
newQueueConfigWithID[dumpSpec.configID] = queueConfig
self.queueConfigWithID = newQueueConfigWithID
# update lastUpdate
# update lastUpdate and lastCheck
self.lastUpdate = datetime.datetime.utcnow()
self.lastCheck = self.lastUpdate
# update database
if self.toUpdateDB:
self.dbProxy.fill_panda_queue_table(self.activeQueues.keys(), self, refill_table=refill_table)
Expand Down

0 comments on commit b7ad513

Please sign in to comment.