From 36a9c304bff46e85b56e6349cfb4a5340469ecf2 Mon Sep 17 00:00:00 2001 From: Ali <010109ali@gmail.com> Date: Mon, 15 Jun 2026 16:36:11 +0000 Subject: [PATCH] fix(wizard): import on default queue to avoid post-setup deadlock (v0.1.35) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Routing the ƏMAS import to the "short" queue (v0.1.34) made it start immediately and run concurrently with the post-setup /app render, which writes tabSessions for the CSRF token — the two deadlocked (QueryDeadlockError). Move it back to the default queue: it starts a bit later, behind the post-setup backlog, but no longer collides. A slightly delayed import beats a deadlocked desk load. Co-Authored-By: Claude Opus 4.8 (1M context) --- jey_wizard/__init__.py | 2 +- jey_wizard/etaxes.py | 14 +++++++++----- jey_wizard/public/js/jey_setup.js | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/jey_wizard/__init__.py b/jey_wizard/__init__.py index 8ef886b..2b033f6 100644 --- a/jey_wizard/__init__.py +++ b/jey_wizard/__init__.py @@ -1 +1 @@ -__version__ = "0.1.34" +__version__ = "0.1.35" diff --git a/jey_wizard/etaxes.py b/jey_wizard/etaxes.py index 84bb81d..75b1d2b 100644 --- a/jey_wizard/etaxes.py +++ b/jey_wizard/etaxes.py @@ -1277,10 +1277,14 @@ def _materialize_amas_employees(company_name): employees_data=json.dumps(employees, ensure_ascii=False), company=company_name, create_designation=create_designation, - # "short" queue jumps ahead of the post-setup backlog on "default", - # so employees start importing as soon as the single worker frees - # instead of after a minute of waiting. - queue="short", + # Keep this on the normal "default" queue, NOT "short". "short" + # makes the import start immediately and run concurrently with the + # still-active post-setup desk load, which writes tabSessions for + # CSRF — the two deadlock on the session row. Letting the import + # wait behind the post-setup backlog costs a bit of latency but + # avoids the QueryDeadlockError. Employees importing slightly later + # is fine; a deadlocked /app render is not. + queue="default", ) # New (post-parallel-import refactor) response shape: # {success: True, enqueued: True, total: N} @@ -1300,7 +1304,7 @@ def _materialize_amas_employees(company_name): employees_data=json.dumps(employees, ensure_ascii=False), company=company_name, create_designation=create_designation, - queue="short", + queue="default", ) except Exception as exc: frappe.log_error( diff --git a/jey_wizard/public/js/jey_setup.js b/jey_wizard/public/js/jey_setup.js index d0562f5..8e2a396 100644 --- a/jey_wizard/public/js/jey_setup.js +++ b/jey_wizard/public/js/jey_setup.js @@ -10,7 +10,7 @@ frappe.provide("jey_wizard"); // Bump this string in every commit that changes wizard code. Displayed in the badge so // we can tell at a glance which version is actually running on a given machine. Kept in // sync with __version__ in jey_wizard/__init__.py. -const JEY_WIZARD_VERSION = "0.1.34"; +const JEY_WIZARD_VERSION = "0.1.35"; // Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners // don't try to mutate a wizard that isn't slide-based anymore.