Skip to content

Commit 47e3b38

Browse files
committed
Force signal on async task
1 parent eabb6e8 commit 47e3b38

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

dbaas/logical/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ def _update_schedule_task(self):
999999
is_valid, err_msg = task.is_valid()
10001000
if not is_valid:
10011001
return is_valid, err_msg
1002-
task.save()
1002+
task.save_if_changed()
10031003

10041004
return True, ''
10051005

dbaas/notification/tasks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ def check_ssl_expire_at(self):
545545
if scheudled_tasks:
546546
task.update_details("Already scheduled!\n", persist=True)
547547
else:
548-
TaskSchedule.objects.create(
548+
from django.db.models.signals import post_save
549+
instance = TaskSchedule.objects.create(
549550
method_path='update_ssl',
550551
scheduled_for=TaskSchedule.next_maintenance_window(
551552
today + timedelta(days=7),
@@ -554,6 +555,7 @@ def check_ssl_expire_at(self):
554555
),
555556
database=database
556557
)
558+
post_save.send(TaskSchedule, instance=instance, created=True)
557559
task.update_details("Schedule created!\n", persist=True)
558560
task.update_status_for(TaskHistory.STATUS_SUCCESS, details="\nDone")
559561
except Exception as err:

0 commit comments

Comments
 (0)