Skip to content

Commit

Permalink
jobs are scheduling, but no connection
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Aug 24, 2023
1 parent 704d8c4 commit b1b3232
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion housewatch/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ def schedule_backups():
backups = ScheduledBackup.objects.filter(enabled=True)
now = timezone.now()
for backup in backups:
nr = croniter(backup.schedule, backup.last_run_time).get_next(datetime)
lrt = backup.last_run_time
if lrt is None:
lrt = backup.created_at
nr = croniter(backup.schedule, lrt).get_next(datetime)
if nr.tzinfo is None:
nr = timezone.make_aware(nr)
logger.info("Checking backup", backup_id=backup.id, next_run=nr, now=now)
if nr < now:
run_backup.delay(backup.id)
backup.last_run_time = now
Expand Down
2 changes: 1 addition & 1 deletion housewatch/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_from_env(key: str, default: Any = None, *, optional: bool = False, type_

USE_I18N = True

USE_TZ = False
USE_TZ = True


# Static files (CSS, JavaScript, Images)
Expand Down

0 comments on commit b1b3232

Please sign in to comment.