fix(wizard): import on default queue to avoid post-setup deadlock (v0.1.35)

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) <noreply@anthropic.com>
This commit is contained in:
Ali 2026-06-15 16:36:11 +00:00
parent 05aac039a9
commit 36a9c304bf
3 changed files with 11 additions and 7 deletions

View File

@ -1 +1 @@
__version__ = "0.1.34" __version__ = "0.1.35"

View File

@ -1277,10 +1277,14 @@ def _materialize_amas_employees(company_name):
employees_data=json.dumps(employees, ensure_ascii=False), employees_data=json.dumps(employees, ensure_ascii=False),
company=company_name, company=company_name,
create_designation=create_designation, create_designation=create_designation,
# "short" queue jumps ahead of the post-setup backlog on "default", # Keep this on the normal "default" queue, NOT "short". "short"
# so employees start importing as soon as the single worker frees # makes the import start immediately and run concurrently with the
# instead of after a minute of waiting. # still-active post-setup desk load, which writes tabSessions for
queue="short", # 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: # New (post-parallel-import refactor) response shape:
# {success: True, enqueued: True, total: N} # {success: True, enqueued: True, total: N}
@ -1300,7 +1304,7 @@ def _materialize_amas_employees(company_name):
employees_data=json.dumps(employees, ensure_ascii=False), employees_data=json.dumps(employees, ensure_ascii=False),
company=company_name, company=company_name,
create_designation=create_designation, create_designation=create_designation,
queue="short", queue="default",
) )
except Exception as exc: except Exception as exc:
frappe.log_error( frappe.log_error(

View File

@ -10,7 +10,7 @@ frappe.provide("jey_wizard");
// Bump this string in every commit that changes wizard code. Displayed in the badge so // 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 // 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. // 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 // 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. // don't try to mutate a wizard that isn't slide-based anymore.