Skip to content

Commit

Permalink
add interval in adv config
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishabh17 committed Nov 19, 2024
1 parent cde9c60 commit 29e22fd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions apps/workspaces/tasks.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 29e22fd

Please sign in to comment.