Skip to content

Commit

Permalink
becomes older datetimes in awake
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Jun 21, 2024
1 parent f145676 commit 9972dca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions breathecode/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ def __exit__(self, *args, **kwargs):
if len(data[i]) >= 2:
data[i].sort(key=lambda x: x['created_at'])

if datetime.now(UTC) - data[i][-1]['created_at'] < delta:
if datetime.now(UTC) - data[i][-1]['created_at'].replace(tzinfo=UTC) < delta:
available[i] = False
data[i] = data[i][-2:]
else:
available[i] = True
data[i] = data[i][-1:]

elif len(data[i]) == 1:
if datetime.now(UTC) - data[i][0]['created_at'] < delta:
if datetime.now(UTC) - data[i][0]['created_at'].replace(tzinfo=UTC) < delta:
available[i] = False
else:
available[i] = True
Expand Down

0 comments on commit 9972dca

Please sign in to comment.