File tree 2 files changed +11
-4
lines changed
django_lightweight_queue/backends
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -61,16 +61,23 @@ def startup(self, queue: QueueName) -> None:
61
61
)
62
62
processing_queue_keys = current_processing_queue_keys - expected_processing_queue_keys
63
63
64
- def move_processing_jobs_to_main (pipe : redis .client .Pipeline ) -> None :
64
+ def move_processing_jobs_to_main (pipe : 'redis.StrictRedis[bytes]' ) -> None :
65
+ # Note: the `pipe` argument here is actually a Pipeline (strictly
66
+ # `redis.client.Pipeline[bytes]`), however it's not the usual
67
+ # late-executing pipeline that might be expected (or that the
68
+ # typeshed expects) so we pretend that it's a StrictRedis instance
69
+ # to get the type checking to *mostly* work. See typeshed issue
70
+ # https://github.com/python/typeshed/issues/6028 for more details.
71
+
65
72
# Collect all the data we need to add, before adding the data back
66
73
# to the main queue of and clearing the processing queues
67
74
# atomically, so if this crashes, we don't lose jobs
68
- all_data = []
75
+ all_data : List [ bytes ] = []
69
76
for key in processing_queue_keys :
70
77
all_data .extend (pipe .lrange (key , 0 , - 1 ))
71
78
72
79
if all_data or processing_queue_keys :
73
- pipe .multi ()
80
+ pipe .multi () # type: ignore[attr-defined] # see https://github.com/python/typeshed/issues/6028
74
81
75
82
# NB we RPUSH, which means these jobs will get processed next
76
83
if all_data :
Original file line number Diff line number Diff line change 2
2
3
3
4
4
class RedisCleanupMixin (object ):
5
- client = NotImplemented # type: redis.StrictRedis
5
+ client = NotImplemented # type: redis.StrictRedis[bytes]
6
6
prefix = NotImplemented # type: str
7
7
8
8
def setUp (self ):
You can’t perform that action at this time.
0 commit comments