build: bump RQ to latest (#31952)

perf fix for busy pubsub thread
This commit is contained in:
Ankush Menat 2025-03-29 12:09:24 +05:30 committed by GitHub
parent c78b3af71c
commit 0f7099c527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 21 deletions

View file

@ -355,26 +355,6 @@ class FrappeWorker(Worker):
Thread(target=start_scheduler, daemon=True).start()
def subscribe(self):
"""Subscribe to this worker's channel"""
# This function is overridden to increase the timeout of pubsub thread. Default is 0.2
# second which is too frequent for us, this change sets it to 2s which is 10x the default.
# ref: https://github.com/frappe/caffeine/issues/46
# The pubsub thread is responsible for handling three commands from master process:
# 1. shutdown
# 2. stop current job
# 3. Kill forked horse (~ force stop the job)
# Impact of increasing timeout: shutdown might have up to 2s before background thread
# times out and is joined with main thread. Ideally, we should not have to do this at all.
# But the code that handles blocking socket behaviour is deep inside redis-py/hiredis.
self.log.info("Subscribing to channel %s", self.pubsub_channel_name)
self.pubsub = self.connection.pubsub()
self.pubsub.subscribe(**{self.pubsub_channel_name: self.handle_payload})
self.pubsub_thread = self.pubsub.run_in_thread(sleep_time=2, daemon=True)
class FrappeWorkerNoFork(FrappeWorker):
def __init__(self, *args, **kwargs):

View file

@ -66,7 +66,7 @@ dependencies = [
# We depend on internal attributes of RQ.
# Do NOT add loose requirements on RQ versions.
# Audit the code changes w.r.t. background_jobs.py before updating.
"rq==2.1.0",
"rq==2.2.0",
"rsa>=4.1",
"semantic-version~=2.10.0",
"sentry-sdk~=1.37.1",