You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!
Version: Happening in redis version 6 and 7 using redis-py version redis[hiredis]==4.3.4
Description:
I've been working on adding limited support to the watch and transactions to redis cluster. Right now we have a flaky test that fails because zrangebyscore sometimes returns a int, more specifically a 0, instead of a list. We are not able to reproduce this locally and only happens during our CI process in GHA. The test fails about half the time which makes to reproduce. I'm more interested in reasons why zrangebyscore would returns a 0 instead of a list since when it works and the set is empty it still returns and empty list.
Test in question
asyncdeftest_mung(arq_redis_cluster: ArqRedisCluster, cluster_worker):
""" check a job can't be enqueued multiple times with the same id """counter=Counter()
asyncdefcount(ctx, v):
counter[v] +=1tasks= []
foriinrange(50):
tasks+= [
arq_redis_cluster.enqueue_job('count', i, _job_id=f'v-{i}'),
arq_redis_cluster.enqueue_job('count', i, _job_id=f'v-{i}'),
]
shuffle(tasks)
awaitasyncio.gather(*tasks)
awaitworker.main()
assertcounter.most_common(1)[0][1] ==1# no job go enqueued twice
asyncdefmain(self) ->None:
ifself._poolisNone:
self._pool=awaitcreate_pool(
self.redis_settings,
job_deserializer=self.job_deserializer,
job_serializer=self.job_serializer,
default_queue_name=self.queue_name,
expires_extra_ms=self.expires_extra_ms,
)
logger.info('Starting worker for %d functions: %s', len(self.functions), ', '.join(self.functions))
self.ctx['redis'] =self.poolifself.on_startup:
awaitself.on_startup(self.ctx)
asyncfor_inpoll(self.poll_delay_s): # noqa F841awaitself._poll_iteration()
ifself.burst:
if0<=self.max_burst_jobs<=self._jobs_started():
awaitasyncio.gather(*self.tasks.values())
returnNonequeued_jobs=awaitself.pool.zcard(self.queue_name)
ifqueued_jobs==0:
awaitasyncio.gather(*self.tasks.values())
returnNoneasyncdef_poll_iteration(self) ->None:
""" Get ids of pending jobs from the main queue sorted-set data structure and start those jobs, remove any finished tasks from self.tasks. """count=self.queue_read_limitifself.burstandself.max_burst_jobs>=0:
burst_jobs_remaining=self.max_burst_jobs-self._jobs_started()
ifburst_jobs_remaining<1:
returncount=min(burst_jobs_remaining, count)
ifself.allow_pick_jobs:
ifself.job_counter<self.max_jobs:
now=timestamp_ms()
job_ids=awaitself.pool.zrangebyscore( ## This returns an int sometimes.##self.queue_name, min=float('-inf'), start=self._queue_read_offset, num=count, max=now
)
awaitself.start_jobs(job_ids) ##fails here as we are expecting the list.##
The text was updated successfully, but these errors were encountered:
Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!
Version: Happening in redis version 6 and 7 using redis-py version
redis[hiredis]==4.3.4
Platform: Python version 3.8 - 3.11 GHA runner used https://github.com/actions/runner-images/blob/ubuntu22/20240204.1/images/ubuntu/Ubuntu2204-Readme.md
Description:
I've been working on adding limited support to the watch and transactions to redis cluster. Right now we have a flaky test that fails because
zrangebyscore
sometimes returns a int, more specifically a 0, instead of a list. We are not able to reproduce this locally and only happens during our CI process in GHA. The test fails about half the time which makes to reproduce. I'm more interested in reasons whyzrangebyscore
would returns a 0 instead of a list since when it works and the set is empty it still returns and empty list.Test in question
The text was updated successfully, but these errors were encountered: