File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -22,21 +22,22 @@ def conf_settings():
22
22
global SCHEDULER_CONFIG
23
23
24
24
app_queues = getattr (settings , "SCHEDULER_QUEUES" , None )
25
- if app_queues is None :
26
- logger .warning ("Configuration using RQ_QUEUES is deprecated. Use SCHEDULER_QUEUES instead" )
27
- app_queues = getattr (settings , "RQ_QUEUES" , None )
28
25
if app_queues is None :
29
26
raise ImproperlyConfigured ("You have to define SCHEDULER_QUEUES in settings.py" )
30
27
31
28
for queue_name , queue_config in app_queues .items ():
32
29
if isinstance (queue_config , QueueConfiguration ):
33
30
_QUEUES [queue_name ] = queue_config
34
- else :
31
+ elif isinstance ( queue_config , dict ) :
35
32
_QUEUES [queue_name ] = QueueConfiguration (** queue_config )
33
+ else :
34
+ raise ImproperlyConfigured (f"Queue { queue_name } configuration should be a QueueConfiguration or dict" )
36
35
37
36
user_settings = getattr (settings , "SCHEDULER_CONFIG" , {})
38
37
if isinstance (user_settings , SchedulerConfiguration ):
39
38
return
39
+ if not isinstance (user_settings , dict ):
40
+ raise ImproperlyConfigured ("SCHEDULER_CONFIG should be a SchedulerConfiguration or dict" )
40
41
if "FAKEREDIS" in user_settings :
41
42
logger .warning ("Configuration using FAKEREDIS is deprecated. Use BROKER='fakeredis' instead" )
42
43
user_settings ["BROKER" ] = Broker .FAKEREDIS if user_settings ["FAKEREDIS" ] else Broker .REDIS
Original file line number Diff line number Diff line change @@ -36,14 +36,6 @@ class SchedulerConfiguration:
36
36
SCHEDULER_FALLBACK_PERIOD_SECS : int = 120 # Period (secs) to wait before requiring to reacquire locks
37
37
DEATH_PENALTY_CLASS : Type ["BaseDeathPenalty" ] = UnixSignalDeathPenalty
38
38
39
- def __contains__ (self , item : str ) -> bool :
40
- return item in self .__annotations__
41
-
42
- def __iter__ (self ) -> Iterator [str ]:
43
- for field in self .__annotations__ :
44
- yield field
45
-
46
-
47
39
@dataclass (slots = True , frozen = True , kw_only = True )
48
40
class QueueConfiguration :
49
41
__CONNECTION_FIELDS__ = {
You can’t perform that action at this time.
0 commit comments