mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 14:08:12 +08:00
Merge pull request #136 from Koed00/dev
Save task now creates or updates
This commit is contained in:
+13
-11
@@ -408,17 +408,19 @@ def save_task(task, broker):
|
|||||||
try:
|
try:
|
||||||
if task['success'] and 0 < Conf.SAVE_LIMIT <= Success.objects.count():
|
if task['success'] and 0 < Conf.SAVE_LIMIT <= Success.objects.count():
|
||||||
Success.objects.last().delete()
|
Success.objects.last().delete()
|
||||||
Task.objects.create(id=task['id'],
|
Task.objects.update_or_create(id=task['id'],
|
||||||
name=task['name'],
|
name=task['name'],
|
||||||
func=task['func'],
|
defaults={
|
||||||
hook=task.get('hook'),
|
'func': task['func'],
|
||||||
args=task['args'],
|
'hook': task.get('hook'),
|
||||||
kwargs=task['kwargs'],
|
'args': task['args'],
|
||||||
started=task['started'],
|
'kwargs': task['kwargs'],
|
||||||
stopped=task['stopped'],
|
'started': task['started'],
|
||||||
result=task['result'],
|
'stopped': task['stopped'],
|
||||||
group=task.get('group'),
|
'result': task['result'],
|
||||||
success=task['success'])
|
'group': task.get('group'),
|
||||||
|
'success': task['success']}
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user