From 851cd979c8f8977d3de121fb01eb0b868ed82567 Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 16 Feb 2021 18:56:45 +0100 Subject: [PATCH 1/5] Add a warning for misconfiguration. As specified in the docs, by default the settings result in a configuration where slow tasks that run for more than 60s cause repeated running of tasks, which has caused a few issues. This warning doesn't change the defaults, which would be a marge larger change, but instead provides a, hopefully, helpful message to the user. --- django_q/conf.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/django_q/conf.py b/django_q/conf.py index ba7e3709..d0f805ee 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -3,6 +3,7 @@ from copy import deepcopy from multiprocessing import cpu_count from signal import signal +from warnings import warn import pkg_resources from django.conf import settings @@ -130,6 +131,13 @@ class Conf: # Only works with brokers that guarantee delivery. Defaults to 60 seconds. RETRY = conf.get("retry", 60) + # Verify if retry and timeout settings are correct + if (retry < timeout) or not timeout: + warn("""Retry and timeout are missconfigured. Set retry larger than timeout, + failure to do so will cause the tasks to be retriggered before completion. + See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""" + + # Sets the amount of tasks the cluster will try to pop off the broker. # If it supports bulk gets. BULK = conf.get("bulk", 1) @@ -189,8 +197,7 @@ class Conf: # to manage workarounds during testing TESTING = conf.get("testing", False) - - + # logger logger = logging.getLogger("django-q") From 001bec88ee327580dbd38b009ee33ce779b56038 Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 16 Feb 2021 19:04:03 +0100 Subject: [PATCH 2/5] fixed missing bracket --- django_q/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_q/conf.py b/django_q/conf.py index d0f805ee..4011901d 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -135,7 +135,7 @@ class Conf: if (retry < timeout) or not timeout: warn("""Retry and timeout are missconfigured. Set retry larger than timeout, failure to do so will cause the tasks to be retriggered before completion. - See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""" + See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""") # Sets the amount of tasks the cluster will try to pop off the broker. From c5660eda49925f1e844060f3b047015611f654a4 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 17 Feb 2021 10:59:36 +0100 Subject: [PATCH 3/5] Update conf.py fixed spelling --- django_q/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_q/conf.py b/django_q/conf.py index 4011901d..56f381d0 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -132,7 +132,7 @@ class Conf: RETRY = conf.get("retry", 60) # Verify if retry and timeout settings are correct - if (retry < timeout) or not timeout: + if (RETRY < TIMEOUT) or not TIMEOUT: warn("""Retry and timeout are missconfigured. Set retry larger than timeout, failure to do so will cause the tasks to be retriggered before completion. See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""") From 0f838565835827aff0fed2c77c0f5923fd59d880 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 17 Feb 2021 11:08:06 +0100 Subject: [PATCH 4/5] Update conf.py Made bool work for python 3.6+ --- django_q/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_q/conf.py b/django_q/conf.py index 56f381d0..aaef3bf9 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -132,7 +132,7 @@ class Conf: RETRY = conf.get("retry", 60) # Verify if retry and timeout settings are correct - if (RETRY < TIMEOUT) or not TIMEOUT: + if not TIMEOUT or (TIMEOUT > RETRY): warn("""Retry and timeout are missconfigured. Set retry larger than timeout, failure to do so will cause the tasks to be retriggered before completion. See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""") From fea33fe687f37c38b5ddf89ef3f924671a3fae4b Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Fri, 26 Feb 2021 13:46:41 +0100 Subject: [PATCH 5/5] Fixing typo --- django_q/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_q/conf.py b/django_q/conf.py index aaef3bf9..15de28a2 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -133,7 +133,7 @@ class Conf: # Verify if retry and timeout settings are correct if not TIMEOUT or (TIMEOUT > RETRY): - warn("""Retry and timeout are missconfigured. Set retry larger than timeout, + warn("""Retry and timeout are misconfigured. Set retry larger than timeout, failure to do so will cause the tasks to be retriggered before completion. See https://django-q.readthedocs.io/en/latest/configure.html#retry for details.""")