From aa71072d4af1b8ae9ba002e0e54c4e0969bfabb9 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Wed, 5 Feb 2025 17:48:03 +0530 Subject: [PATCH] build: bump RQ to 2.x (#31141) * build: bump RQ to 2.x * fix: dont use colon for job IDs --- frappe/core/doctype/data_import/data_import.py | 2 +- frappe/core/doctype/scheduled_job_type/scheduled_job_type.py | 2 +- frappe/utils/background_jobs.py | 3 ++- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frappe/core/doctype/data_import/data_import.py b/frappe/core/doctype/data_import/data_import.py index 7cd4a399f0..8e4f823024 100644 --- a/frappe/core/doctype/data_import/data_import.py +++ b/frappe/core/doctype/data_import/data_import.py @@ -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( diff --git a/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py b/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py index 426ab54d7a..c2c6eae49a 100644 --- a/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py +++ b/frappe/core/doctype/scheduled_job_type/scheduled_job_type.py @@ -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): diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py index a57b43a811..77882ee83a 100644 --- a/frappe/utils/background_jobs.py +++ b/frappe/utils/background_jobs.py @@ -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: diff --git a/pyproject.toml b/pyproject.toml index fd125621a1..b2783f4668 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",