Skip to content

Commit

Permalink
Merge pull request #781 from CDLUC3/727-fix_cleanup-async-queues
Browse files Browse the repository at this point in the history
727 fix cleanup async queues
  • Loading branch information
jsjiang authored Nov 5, 2024
2 parents b8e72bb + a3440ea commit 4d77f6c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ezidapp/management/commands/proc-cleanup-async-queues_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,11 @@ def run(self):
log.info(f"Finished - Checking ref Ids: {time_range_str}")
exit()
else:
log.info(f"Sleep {ASYNC_CLEANUP_SLEEP} seconds before processing next batch")
log.info(f"Sleep {ASYNC_CLEANUP_SLEEP} seconds before processing next time range.")
self.sleep(ASYNC_CLEANUP_SLEEP)
last_id = 0
min_age_ts = max_age_ts
max_age_ts = min_age_ts + ASYNC_CLEANUP_SLEEP
max_age_ts = int(time.time()) - django.conf.settings.DAEMONS_EXPUNGE_MAX_AGE_SEC
time_range = Q(updateTime__gte=min_age_ts) & Q(updateTime__lte=max_age_ts)
time_range_str = f"updated between: {self.seconds_to_date(min_age_ts)} and {self.seconds_to_date(max_age_ts)}"
else:
Expand All @@ -196,8 +197,7 @@ def deleteRecord(self, queue, primary_key, record_type=None, identifier=None):
try:
# check if the record to be deleted is a refIdentifier record
if (record_type is not None and record_type == 'refId'):
log.info(type(queue))
log.info("Delete refId: " + str(primary_key))
log.info(f"Delete from {queue.__name__} refId: " + str(primary_key))
with transaction.atomic():
obj = queue.objects.select_for_update().get(id=primary_key)
obj.delete()
Expand Down

0 comments on commit 4d77f6c

Please sign in to comment.