Do not watch dependency key set

main
Thomas Matecki 5 years ago
parent 540be93401
commit a69d91d2b2

@ -744,9 +744,8 @@ class Job(object):
pipe = pipeline if pipeline is not None else self.connection
if watch:
pipe.watch(self.dependencies_key)
pipe.watch(*[self.redis_job_namespace_prefix + as_text(_id)
for _id in pipe.smembers(self.dependencies_key)])
pipe.watch(*[Job.key_for(_id)
for _id in self.connection.smembers(self.dependencies_key)])
sort_by = self.redis_job_namespace_prefix + '*->ended_at'
get_field = self.redis_job_namespace_prefix + '*->status'
@ -762,5 +761,4 @@ class Job(object):
return dependencies_statuses
_job_stack = LocalStack()

@ -905,29 +905,3 @@ class TestJob(RQTestCase):
with self.assertRaises(WatchError):
pipeline.touch(Job.key_for(dependent_job.id))
pipeline.execute()
def test_get_dependencies_statuses_watches_dependency_set(self):
queue = Queue(connection=self.testconn)
dependency_job = queue.enqueue(fixtures.say_hello)
dependent_job = Job.create(func=fixtures.say_hello)
dependent_job._dependency_ids = [dependency_job.id]
dependent_job.register_dependency()
with self.testconn.pipeline() as pipeline:
dependent_job.get_dependencies_statuses(
pipeline=pipeline,
watch=True
)
self.testconn.sadd(
dependent_job.dependencies_key,
queue.enqueue(fixtures.say_hello).id,
)
pipeline.multi()
with self.assertRaises(WatchError):
pipeline.touch(Job.key_for(dependent_job.id))
pipeline.execute()

Loading…
Cancel
Save