1
- from typing import List , Dict
1
+ from typing import List , Dict , Set
2
2
3
3
import redis
4
4
import valkey
@@ -87,7 +87,7 @@ def get_connection(queue_settings, use_strict_redis=False):
87
87
88
88
89
89
def get_queue (
90
- name = "default" , default_timeout = None , is_async = None , autocommit = None , connection = None , ** kwargs
90
+ name = "default" , default_timeout = None , is_async = None , autocommit = None , connection = None , ** kwargs
91
91
) -> DjangoQueue :
92
92
"""Returns an DjangoQueue using parameters defined in `SCHEDULER_QUEUES`"""
93
93
from .settings import QUEUES
@@ -107,18 +107,18 @@ def get_queue(
107
107
)
108
108
109
109
110
- def get_all_workers ():
110
+ def get_all_workers () -> Set [ DjangoWorker ] :
111
111
from .settings import QUEUES
112
112
113
- workers = set ()
113
+ workers_set : Set [ DjangoWorker ] = set ()
114
114
for queue_name in QUEUES :
115
115
connection = get_connection (QUEUES [queue_name ])
116
116
try :
117
- curr_workers = set (DjangoWorker .all (connection = connection ))
118
- workers .update (curr_workers )
117
+ curr_workers : Set [ DjangoWorker ] = set (DjangoWorker .all (connection = connection ))
118
+ workers_set .update (curr_workers )
119
119
except (redis .ConnectionError , valkey .ConnectionError ) as e :
120
120
logger .error (f"Could not connect for queue { queue_name } : { e } " )
121
- return workers
121
+ return workers_set
122
122
123
123
124
124
def _queues_share_connection_params (q1_params : Dict , q2_params : Dict ):
0 commit comments