File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
django_lightweight_queue/backends Expand file tree Collapse file tree 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:
6161 )
6262 processing_queue_keys = current_processing_queue_keys - expected_processing_queue_keys
6363
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+
6572 # Collect all the data we need to add, before adding the data back
6673 # to the main queue of and clearing the processing queues
6774 # atomically, so if this crashes, we don't lose jobs
68- all_data = []
75+ all_data : List [ bytes ] = []
6976 for key in processing_queue_keys :
7077 all_data .extend (pipe .lrange (key , 0 , - 1 ))
7178
7279 if all_data or processing_queue_keys :
73- pipe .multi ()
80+ pipe .multi () # type: ignore[attr-defined] # see explanation above
7481
7582 # NB we RPUSH, which means these jobs will get processed next
7683 if all_data :
Original file line number Diff line number Diff line change 22
33
44class RedisCleanupMixin (object ):
5- client = NotImplemented # type: redis.StrictRedis
5+ client = NotImplemented # type: redis.StrictRedis[bytes]
66 prefix = NotImplemented # type: str
77
88 def setUp (self ):
You can’t perform that action at this time.
0 commit comments