build: bump RQ to 2.x (#31141)

* build: bump RQ to 2.x

* fix: dont use colon for job IDs
This commit is contained in:
Ankush Menat 2025-02-05 17:48:03 +05:30 committed by GitHub
parent c038c16bee
commit aa71072d4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View file

@ -105,7 +105,7 @@ class DataImport(Document):
if is_scheduler_inactive() and not run_now:
frappe.throw(_("Scheduler is inactive. Cannot import data."), title=_("Scheduler Inactive"))
job_id = f"data_import::{self.name}"
job_id = f"data_import||{self.name}"
if not is_job_enqueued(job_id):
enqueue(

View file

@ -95,7 +95,7 @@ class ScheduledJobType(Document):
@property
def rq_job_id(self):
"""Unique ID created to deduplicate jobs with single RQ call."""
return f"scheduled_job::{self.name}"
return f"scheduled_job||{self.name}"
@property
def next_execution(self):

View file

@ -327,6 +327,7 @@ def start_worker(
date_format="%Y-%m-%d %H:%M:%S",
log_format="%(asctime)s,%(msecs)03d %(message)s",
dequeue_strategy=strategy,
with_scheduler=False,
)
@ -611,7 +612,7 @@ def create_job_id(job_id: str | None = None) -> str:
if not job_id:
job_id = str(uuid4())
return f"{frappe.local.site}::{job_id}"
return f"{frappe.local.site}||{job_id}"
def is_job_enqueued(job_id: str) -> bool:

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==1.16.2",
"rq==2.1.0",
"rsa>=4.1",
"semantic-version~=2.10.0",
"sentry-sdk~=1.37.1",