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():
2222 global SCHEDULER_CONFIG
2323
2424 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 )
2825 if app_queues is None :
2926 raise ImproperlyConfigured ("You have to define SCHEDULER_QUEUES in settings.py" )
3027
3128 for queue_name , queue_config in app_queues .items ():
3229 if isinstance (queue_config , QueueConfiguration ):
3330 _QUEUES [queue_name ] = queue_config
34- else :
31+ elif isinstance ( queue_config , dict ) :
3532 _QUEUES [queue_name ] = QueueConfiguration (** queue_config )
33+ else :
34+ raise ImproperlyConfigured (f"Queue { queue_name } configuration should be a QueueConfiguration or dict" )
3635
3736 user_settings = getattr (settings , "SCHEDULER_CONFIG" , {})
3837 if isinstance (user_settings , SchedulerConfiguration ):
3938 return
39+ if not isinstance (user_settings , dict ):
40+ raise ImproperlyConfigured ("SCHEDULER_CONFIG should be a SchedulerConfiguration or dict" )
4041 if "FAKEREDIS" in user_settings :
4142 logger .warning ("Configuration using FAKEREDIS is deprecated. Use BROKER='fakeredis' instead" )
4243 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:
3636 SCHEDULER_FALLBACK_PERIOD_SECS : int = 120 # Period (secs) to wait before requiring to reacquire locks
3737 DEATH_PENALTY_CLASS : Type ["BaseDeathPenalty" ] = UnixSignalDeathPenalty
3838
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-
4739@dataclass (slots = True , frozen = True , kw_only = True )
4840class QueueConfiguration :
4941 __CONNECTION_FIELDS__ = {
You can’t perform that action at this time.
0 commit comments