From 4048e5b189543c32cf3764081c929cf094300d7d Mon Sep 17 00:00:00 2001
From: Dominik George <nik@naturalnet.de>
Date: Wed, 18 Nov 2020 22:15:18 +0100
Subject: [PATCH] Add setting CELERY_HAYSTACK_IGNORE_RESULT

If True, results of the signal handler task will not be written to any
result store to not produce large amounts of irrelevant results.

Errors will still be stored.
---
 celery_haystack/conf.py  | 2 ++
 celery_haystack/tasks.py | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/celery_haystack/conf.py b/celery_haystack/conf.py
index 26f278a..c88c488 100644
--- a/celery_haystack/conf.py
+++ b/celery_haystack/conf.py
@@ -20,6 +20,8 @@ class CeleryHaystack(AppConf):
     QUEUE = None
     #: Whether the task should be handled transaction safe
     TRANSACTION_SAFE = True
+    #: Whether the task results should be ignored
+    IGNORE_RESULT = False
 
     #: The batch size used by the CeleryHaystackUpdateIndex task
     COMMAND_BATCH_SIZE = None
diff --git a/celery_haystack/tasks.py b/celery_haystack/tasks.py
index d8acedd..e2a1ce0 100644
--- a/celery_haystack/tasks.py
+++ b/celery_haystack/tasks.py
@@ -17,6 +17,8 @@ class CeleryHaystackSignalHandler(Task):
     using = settings.CELERY_HAYSTACK_DEFAULT_ALIAS
     max_retries = settings.CELERY_HAYSTACK_MAX_RETRIES
     default_retry_delay = settings.CELERY_HAYSTACK_RETRY_DELAY
+    ignore_result = settings.CELERY_HAYSTACK_IGNORE_RESULT
+    store_errors_even_if_ignored = True
 
     def split_identifier(self, identifier, **kwargs):
         """
-- 
GitLab