From cadbc9f220838778120d0c7d2dab80e4f0d01c46 Mon Sep 17 00:00:00 2001 From: Vladimir Rychkov Date: Wed, 13 Jul 2016 09:44:26 +0100 Subject: [PATCH] exception raised if guard_cycle configured not in range (0, 60) --- django_q/conf.py | 2 ++ docs/configure.rst | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/django_q/conf.py b/django_q/conf.py index ccf8a5d..dfa719a 100644 --- a/django_q/conf.py +++ b/django_q/conf.py @@ -73,6 +73,8 @@ class Conf(object): # Guard loop sleep in seconds GUARD_CYCLE = conf.get('guard_cycle', 0.5) + if GUARD_CYCLE <= 0 or GUARD_CYCLE >= 60: + raise ValueError('`guard_cycle` must be greater than 0 and less than 60 sec') # Disable the scheduler SCHEDULER = conf.get('scheduler', True) diff --git a/docs/configure.rst b/docs/configure.rst index 73a1c6a..714881a 100644 --- a/docs/configure.rst +++ b/docs/configure.rst @@ -81,7 +81,7 @@ Limits the amount of successful tasks saved to Django. guard_cycle ~~~~~~~~~~~ -Guard loop sleep in seconds +Guard loop sleep in seconds, must be greater than 0 and less than 60. .. _sync: