Merge pull request #740 from taigaio/issue/4257/Mutiple_configured_webhhoks_trigger_on_the_same_url
Issue 4257: Mutiple configured webhhoks trigger on the same urlremotes/origin/issue/4795/notification_even_they_are_disabled
commit
84e2b90168
|
@ -67,10 +67,18 @@ def on_new_history_entry(sender, instance, created, **kwargs):
|
||||||
by = instance.owner
|
by = instance.owner
|
||||||
date = timezone.now()
|
date = timezone.now()
|
||||||
|
|
||||||
|
webhooks_args = []
|
||||||
for webhook in webhooks:
|
for webhook in webhooks:
|
||||||
args = [webhook["id"], webhook["url"], webhook["key"], by, date, obj] + extra_args
|
args = [webhook["id"], webhook["url"], webhook["key"], by, date, obj] + extra_args
|
||||||
|
webhooks_args.append(args)
|
||||||
|
|
||||||
|
connection.on_commit(lambda: _execute_task(task, webhooks_args))
|
||||||
|
|
||||||
|
|
||||||
|
def _execute_task(task, webhooks_args):
|
||||||
|
for webhook_args in webhooks_args:
|
||||||
|
|
||||||
if settings.CELERY_ENABLED:
|
if settings.CELERY_ENABLED:
|
||||||
connection.on_commit(lambda: task.delay(*args))
|
task.delay(*webhook_args)
|
||||||
else:
|
else:
|
||||||
connection.on_commit(lambda: task(*args))
|
task(*webhook_args)
|
||||||
|
|
Loading…
Reference in New Issue