From f3ae8c73e4cb4da2f5ca7d2576c6a6d7ee242cf8 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 31 May 2016 08:58:42 +0200 Subject: [PATCH] Issue 4257: Mutiple configured webhhoks trigger on the same url --- taiga/webhooks/signal_handlers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/taiga/webhooks/signal_handlers.py b/taiga/webhooks/signal_handlers.py index d1c10ba1..5186454a 100644 --- a/taiga/webhooks/signal_handlers.py +++ b/taiga/webhooks/signal_handlers.py @@ -67,10 +67,18 @@ def on_new_history_entry(sender, instance, created, **kwargs): by = instance.owner date = timezone.now() + webhooks_args = [] for webhook in webhooks: 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: - connection.on_commit(lambda: task.delay(*args)) + task.delay(*webhook_args) else: - connection.on_commit(lambda: task(*args)) + task(*webhook_args)