maziggy
35c93a5362
fix(tests): give each concurrent-dispatch session its own connection
...
The scheduler's concurrent-dispatch tests failed on CI and passed
locally, on a commit that touched nothing but a text file. Six tests
in tests/unit/test_scheduler_concurrent_dispatch.py went red with
every queue item logged as "Status set to 'printing'" and four of
them read back as "pending", alongside "cannot commit transaction -
SQL statements in progress" and a PrintArchive that could not be
refreshed.
The fixtures built their farm on sqlite+aiosqlite:///:memory:, and
SQLAlchemy backs an in-memory SQLite with a StaticPool: one DBAPI
connection handed to every session, with nothing keeping them apart.
That was harmless while check_queue awaited its uploads inline,
because only one session was ever live at a time. Under the
refillable upload pool the uploads run as concurrent background
tasks with a session each, so their transactions interleave on that
single connection - a sibling session's close() rolls back another's
flushed-but-uncommitted UPDATE, and a commit() landing while another
session still holds a cursor raises the commit error above. Whether
the interleaving lands badly comes down to core count and
interpreter version, which is why a 30-core box on 3.13 stayed green
and a 4-vCPU runner on 3.11 did not.
The four fixtures now put the database in the test's own tmp_path,
which gets an AsyncAdaptedQueuePool and a connection per session -
what the application itself runs with (_resolve_pool_kwargs in
backend/app/core/database.py: pool_size 20, max_overflow 200). So
the harness is being brought in line with production rather than
having its assertions relaxed; nothing in the scheduler changes,
and the concurrency under test was correct throughout.
Checked against the failure mode rather than against a green run: an
isolated repro of the same shape - six writer sessions and one
reader session closing mid-transaction - yields all-pending on the
in-memory engine and all-printing on a file. The new risk is real
SQLite write contention on one file, so the file was run twelve
times pinned to two cores with no failures and no lock errors.
tests/unit/test_scheduler_busy_reasons_3018.py carries the same
harness on an in-memory engine, but dispatches to a single printer,
so it has no second session to race; left as is.
2026-09-25 14:00:07 +02:00
..
2026-08-30 08:01:42 +02:00
2026-09-24 11:22:40 +02:00
2026-08-23 10:36:50 +02:00
2026-08-17 09:26:13 +02:00
2026-07-29 08:40:42 +02:00
2026-07-22 09:57:27 +02:00
2026-08-25 15:03:34 +02:00
2026-09-24 11:59:30 +02:00
2026-07-18 08:11:44 +02:00
2026-08-23 15:17:09 +02:00
2026-08-25 15:03:34 +02:00
2026-07-18 13:06:01 +02:00
2026-08-28 14:26:34 +02:00
2026-08-29 08:51:33 +02:00
2026-08-17 09:26:13 +02:00
2026-07-19 09:29:54 +02:00
2026-06-03 10:14:57 +02:00
2026-08-27 13:03:15 +02:00
2026-07-21 08:46:02 +02:00
2026-05-30 13:49:09 +02:00
2026-06-20 12:07:20 +02:00
2026-09-19 10:38:54 +02:00
2026-08-29 09:23:48 +02:00
2026-08-08 11:19:33 +02:00
2026-08-28 10:30:32 +02:00
2026-07-30 10:31:22 +02:00
2026-05-22 10:02:41 +02:00
2026-07-30 12:52:11 +02:00
2026-07-30 12:35:27 +02:00
2026-07-30 10:31:22 +02:00
2026-06-06 13:40:56 +02:00
2026-08-03 08:52:23 +02:00
2026-06-25 09:00:57 +02:00
2026-09-20 12:12:56 +02:00
2026-09-20 12:12:56 +02:00
2026-07-28 15:05:28 +02:00
2026-05-24 12:51:24 +02:00
2026-08-25 13:45:57 +02:00
2026-08-11 12:50:42 +02:00
2026-08-14 14:26:30 +02:00
2026-08-03 15:12:02 +02:00
2026-07-30 16:31:09 +02:00
2026-07-31 14:28:17 +02:00
2026-08-18 13:43:46 +02:00
2026-08-29 10:46:36 +02:00
2026-07-18 13:48:14 +02:00
2026-08-17 08:05:02 +02:00
2026-08-18 16:23:32 +02:00
2026-05-24 10:16:30 +02:00
2026-07-30 16:31:09 +02:00
2026-08-29 10:46:36 +02:00
2026-08-29 10:46:36 +02:00
2026-08-15 13:40:21 +02:00
2026-08-17 12:17:12 +02:00
2026-07-30 16:31:09 +02:00
2026-07-30 13:05:15 +02:00
2026-09-19 10:52:15 +02:00
2026-09-19 10:52:15 +02:00
2026-08-17 10:26:38 +02:00
2026-09-18 17:55:06 +02:00
2026-06-05 13:53:26 +02:00
2026-08-28 08:28:27 +02:00
2026-09-18 13:38:02 +02:00
2026-05-29 10:55:41 +02:00
2026-08-25 09:33:52 +02:00
2026-09-21 11:18:35 +02:00
2026-08-27 08:37:35 +02:00
2026-08-29 08:51:33 +02:00
2026-05-24 08:49:21 +02:00
2026-08-28 09:23:30 +02:00
2026-06-09 07:38:59 +02:00
2026-07-18 16:15:09 +02:00
2026-08-13 12:04:56 +02:00
2026-05-28 08:40:43 +02:00
2026-07-31 09:30:06 +02:00
2026-07-31 12:55:05 +02:00
2026-06-06 13:30:13 +02:00
2026-07-13 09:18:17 +02:00
2026-08-16 15:59:59 +02:00
2026-06-19 11:29:07 +02:00
2026-08-04 08:57:34 -04:00
2026-08-06 12:08:36 +02:00
2026-09-20 12:12:56 +02:00
2026-08-06 08:46:02 +02:00
2026-08-25 12:17:23 +02:00
2026-08-25 12:17:23 +02:00
2026-08-24 09:47:39 +02:00
2026-08-24 09:47:39 +02:00
2026-08-22 13:22:56 +02:00
2026-08-28 13:30:27 +02:00
2026-08-25 09:33:52 +02:00
2026-08-27 16:04:41 +02:00
2026-07-18 13:48:14 +02:00
2026-08-09 14:10:18 +02:00
2026-07-30 17:34:13 +01:00
2026-06-02 14:51:08 +02:00
2026-06-02 14:51:08 +02:00
2026-05-22 10:22:14 +02:00
2026-07-12 08:44:53 +02:00
2026-06-22 14:23:30 +02:00
2026-08-25 12:17:23 +02:00
2026-08-25 12:17:23 +02:00
2026-06-17 11:33:23 +02:00
2026-08-23 15:17:09 +02:00
2026-08-02 11:17:49 +02:00
2026-08-14 14:49:55 +02:00
2026-09-20 12:12:56 +02:00
2026-09-20 12:12:56 +02:00
2026-08-25 07:55:49 +02:00
2026-09-23 16:58:14 +02:00
2026-09-20 12:12:56 +02:00
2026-09-18 17:13:26 +02:00
2026-07-14 10:35:58 +02:00
2026-08-25 12:17:23 +02:00
2026-08-13 12:04:56 +02:00
2026-08-17 09:26:13 +02:00
2026-06-02 10:02:17 +02:00
2026-06-02 10:02:17 +02:00
2026-06-02 12:42:16 +02:00
2026-06-20 08:28:44 +02:00
2026-08-25 12:17:23 +02:00
2026-08-14 09:18:55 +02:00
2026-08-14 11:27:50 +02:00
2026-08-25 08:49:24 +02:00
2026-07-28 21:05:29 +00:00
2026-07-28 21:05:29 +00:00
2026-08-01 11:37:01 +02:00
2026-09-07 10:39:10 +02:00
2026-06-25 14:54:27 +02:00
2026-08-02 11:09:32 +02:00
2026-08-13 12:04:56 +02:00
2026-06-24 11:01:16 +02:00
2026-08-18 09:34:03 +02:00
2026-08-11 11:49:30 +02:00
2026-07-11 14:22:31 +02:00
2026-07-30 16:31:09 +02:00
2026-08-10 16:48:10 +02:00
2026-08-03 14:53:21 +02:00
2026-06-09 09:16:36 +02:00
2026-09-18 13:38:02 +02:00
2026-08-25 11:19:46 +02:00
2026-08-26 12:04:42 +02:00
2026-08-26 12:04:42 +02:00
2026-08-19 08:26:43 +02:00
2026-08-22 13:22:56 +02:00
2026-08-01 10:35:22 +02:00
2026-08-26 12:04:42 +02:00
2026-05-21 08:30:17 +02:00
2026-06-20 12:55:24 +02:00
2026-08-08 16:33:41 +02:00
2026-09-07 14:37:49 +02:00
2026-07-17 10:02:19 +02:00
2026-06-08 08:18:13 +02:00
2026-08-14 15:32:40 +02:00
2026-08-25 11:19:46 +02:00
2026-06-11 09:23:03 +02:00
2026-06-25 11:07:29 +02:00
2026-08-25 16:22:43 +02:00
2026-07-18 13:06:01 +02:00
2026-09-23 16:58:14 +02:00
2026-08-27 13:42:55 +02:00
2026-08-23 14:25:45 +02:00
2026-08-22 13:22:56 +02:00
2026-07-20 11:52:18 +02:00
2026-07-20 11:52:18 +02:00
2026-05-25 09:04:47 +02:00
2026-06-02 12:12:54 +02:00
2026-08-15 13:40:21 +02:00
2026-08-15 13:40:21 +02:00
2026-08-15 13:40:21 +02:00
2026-07-07 12:17:46 +02:00
2026-09-18 14:01:36 +02:00
2026-07-07 12:17:46 +02:00
2026-08-15 10:38:51 +02:00
2026-09-07 12:22:26 +02:00
2026-08-15 10:38:51 +02:00
2026-08-09 17:07:34 -04:00
2026-08-19 08:26:43 +02:00
2026-08-15 10:38:51 +02:00
2026-08-15 13:40:21 +02:00
2026-09-25 14:00:07 +02:00
2026-08-05 13:15:04 +02:00
2026-08-10 09:31:25 +02:00
2026-08-05 13:15:04 +02:00
2026-06-09 10:43:07 +02:00
2026-07-24 13:13:04 +02:00
2026-09-18 19:38:24 +02:00
2026-05-24 09:18:38 +02:00
2026-08-10 13:54:44 +02:00
2026-07-17 06:51:51 +02:00
2026-08-22 08:46:07 +02:00
2026-09-18 19:38:24 +02:00
2026-07-22 09:57:27 +02:00
2026-08-28 11:22:03 +02:00
2026-08-09 17:07:34 -04:00
2026-09-18 14:01:36 +02:00
2026-07-20 12:30:39 +02:00
2026-08-15 10:38:51 +02:00
2026-08-15 13:40:21 +02:00
2026-08-15 13:40:21 +02:00
2026-08-04 08:49:49 +02:00
2026-06-17 12:04:57 +02:00
2026-08-18 13:43:46 +02:00
2026-08-15 11:37:01 +02:00
2026-08-11 09:02:52 +02:00
2026-08-15 11:37:01 +02:00
2026-08-14 16:02:53 +02:00
2026-08-24 11:04:33 +02:00
2026-08-03 14:10:02 +02:00
2026-08-28 09:23:30 +02:00
2026-08-29 14:14:26 +02:00
2026-08-29 14:14:26 +02:00
2026-08-09 11:25:09 +02:00
2026-07-22 10:44:05 +02:00
2026-07-31 15:14:01 +02:00
2026-08-11 08:35:23 +02:00
2026-08-27 13:42:55 +02:00
2026-07-22 09:57:27 +02:00
2026-08-15 10:38:51 +02:00
2026-06-28 13:52:05 +02:00
2026-08-27 13:03:15 +02:00
2026-08-25 13:45:57 +02:00
2026-06-17 11:33:23 +02:00
2026-08-28 09:46:37 +02:00
2026-08-14 15:32:40 +02:00
2026-07-30 13:52:56 +02:00
2026-07-15 07:29:16 +02:00
2026-08-14 15:32:40 +02:00
2026-08-26 12:04:42 +02:00
2026-05-22 09:05:25 +02:00
2026-07-14 10:35:58 +02:00
2026-07-31 15:32:08 +02:00
2026-08-09 14:10:18 +02:00
2026-07-29 14:10:38 +02:00
2026-08-03 08:52:23 +02:00
2026-08-13 08:37:16 +02:00
2026-08-05 21:25:46 +02:00
2026-07-29 11:51:30 +02:00
2026-08-30 08:01:42 +02:00
2026-08-13 17:23:41 +02:00
2026-06-27 11:28:00 +02:00
2026-08-13 08:37:16 +02:00
2026-08-13 08:37:16 +02:00
2026-07-18 13:18:59 +02:00
2026-06-22 11:15:39 +02:00
2026-08-03 10:17:28 +02:00
2026-06-05 17:19:16 +02:00
2026-05-30 13:34:10 +02:00
2026-05-30 13:34:10 +02:00
2026-07-05 10:32:13 +02:00
2026-06-02 14:33:20 +02:00
2026-08-29 15:25:26 +02:00
2026-07-02 10:13:01 +02:00
2026-06-03 10:04:37 +02:00
2026-06-11 13:35:20 +02:00
2026-09-20 10:06:47 +02:00
2026-06-27 11:28:00 +02:00