From 29e22fdb65fdb93a9a003313c525d02e59bcb897 Mon Sep 17 00:00:00 2001 From: Hrishabh Tiwari <74908943+Hrishabh17@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:22:24 +0530 Subject: [PATCH] add interval in adv config --- apps/workspaces/tasks.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/workspaces/tasks.py b/apps/workspaces/tasks.py index 9fd6d230..b754e44c 100644 --- a/apps/workspaces/tasks.py +++ b/apps/workspaces/tasks.py @@ -1,5 +1,5 @@ import logging -from datetime import date, datetime +from datetime import date, datetime, timedelta from typing import List from django.conf import settings @@ -65,7 +65,14 @@ def schedule_sync(workspace_id: int, schedule_enabled: bool, hours: int, email_a if email_added: ws_schedule.additional_email_options.append(email_added) - schedule, _ = Schedule.objects.update_or_create(func='apps.workspaces.tasks.run_sync_schedule', args='{}'.format(workspace_id), defaults={'schedule_type': Schedule.MINUTES, 'minutes': hours * 60, 'next_run': datetime.now()}) + schedule, _ = Schedule.objects.update_or_create( + func='apps.workspaces.tasks.run_sync_schedule', + args='{}'.format(workspace_id), + defaults={ + 'schedule_type': Schedule.MINUTES, + 'minutes': hours * 60, + 'next_run': datetime.now() + timedelta(hours=hours), + }) ws_schedule.schedule = schedule