zarzet
9a506b8aaf
fix(history): let History and Library writes take turns instead of racing
...
Issue 948: a finished download showed as failed with "database is locked".
The Library connection has history.db attached, and BEGIN IMMEDIATE takes
the write lock on every attached database, so each Library write transaction
(a scan publication can run for a long time) shut History writes out. SQLite
settles that race with a timeout only, and the download's history write was
the one that lost.
Both connections are ours, so they now wait for each other in Dart. A
connection joins a named writer queue (History when it opens, the Library
connection where it attaches history.db) and transactionWithBusyRetry runs
the queue's transactions one after another, in the order they asked. The
download stays in its finalizing state until its history row is written and
then completes.
Guards: a write made inside the holder's own transaction skips the queue, as
it cannot wait for itself; a callback that outlives its transaction queues
again; after two minutes a waiter goes to SQLite anyway, so a stuck holder
cannot stop every later write. The BEGIN retry stays for holders outside the
queue (plain Library transactions, native code).
2026-11-22 14:18:20 +07:00
..
2026-11-17 02:06:37 +07:00
2026-11-08 16:27:34 +07:00
2026-11-21 22:03:37 +07:00
2026-11-17 02:06:37 +07:00
2026-11-01 20:39:57 +07:00
2026-11-22 00:17:34 +07:00
2026-11-16 15:57:17 +07:00
2026-10-25 04:32:46 +07:00
2026-10-31 01:20:41 +07:00
2026-10-20 12:00:44 +07:00
2026-11-17 02:06:37 +07:00
2026-11-03 13:17:12 +07:00
2026-10-20 12:00:44 +07:00
2026-11-15 23:33:29 +07:00
2026-11-18 21:48:21 +07:00
2026-10-23 23:08:48 +07:00
2026-11-18 21:48:21 +07:00
2026-11-06 20:53:20 +07:00
2026-11-01 19:11:45 +07:00
2026-11-11 11:54:00 +07:00
2026-09-17 02:59:22 +07:00
2026-11-05 00:36:30 +07:00
2026-11-17 02:06:37 +07:00
2026-11-17 02:06:37 +07:00
2026-11-17 02:06:37 +07:00
2026-11-11 11:54:00 +07:00
2026-11-04 01:35:52 +07:00
2026-11-17 02:06:37 +07:00
2026-11-18 01:00:13 +07:00
2026-11-21 21:20:02 +07:00
2026-11-21 21:20:02 +07:00
2026-10-23 15:39:44 +07:00
2026-10-23 15:39:44 +07:00
2026-11-01 19:15:49 +07:00
2026-11-07 20:12:16 +07:00
2026-11-17 02:06:37 +07:00
2026-10-25 23:36:14 +07:00
2026-10-25 23:36:14 +07:00
2026-10-25 23:36:14 +07:00
2026-11-17 02:06:37 +07:00
2026-11-17 02:06:37 +07:00
2026-10-30 18:55:58 +07:00
2026-10-23 23:08:48 +07:00
2026-11-21 15:08:08 +07:00
2026-10-20 12:00:44 +07:00
2026-11-03 13:17:12 +07:00
2026-11-17 02:06:37 +07:00
2026-11-21 11:31:47 +07:00
2026-10-07 03:03:44 +07:00
2026-11-22 00:34:47 +07:00
2026-10-20 12:00:44 +07:00
2026-10-20 12:00:44 +07:00
2026-11-04 04:03:46 +07:00
2026-11-15 23:33:45 +07:00
2026-10-20 12:00:44 +07:00
2026-10-31 22:14:06 +07:00
2026-11-20 21:35:36 +07:00
2026-10-23 23:08:48 +07:00
2026-11-21 15:08:08 +07:00
2026-11-21 22:03:37 +07:00
2026-10-23 23:08:48 +07:00
2026-11-21 15:08:09 +07:00
2026-11-16 18:56:32 +07:00
2026-10-31 22:11:10 +07:00
2026-10-20 16:14:40 +07:00
2026-11-15 17:33:24 +07:00
2026-10-22 02:43:04 +07:00
2026-11-03 13:17:12 +07:00
2026-10-20 12:00:44 +07:00
2026-11-16 23:38:59 +07:00
2026-11-01 14:24:35 +07:00
2026-10-20 12:00:44 +07:00
2026-10-05 02:31:01 +07:00
2026-10-21 01:48:14 +07:00
2026-11-15 17:43:22 +07:00
2026-10-31 23:28:11 +07:00
2026-10-20 16:14:40 +07:00
2026-11-17 11:55:17 +07:00
2026-10-20 12:00:44 +07:00
2026-10-20 12:00:44 +07:00
2026-11-18 21:48:21 +07:00
2026-11-18 21:48:21 +07:00
2026-11-07 19:48:04 +07:00
2026-11-01 19:11:43 +07:00
2026-10-06 13:09:26 +07:00
2026-10-08 17:25:11 +07:00
2026-10-20 12:00:44 +07:00
2026-11-20 21:35:36 +07:00
2026-11-08 00:17:44 +07:00
2026-11-01 20:30:50 +07:00
2026-11-21 15:08:09 +07:00
2026-11-12 01:31:18 +07:00
2026-11-16 18:38:13 +07:00
2026-10-20 12:00:44 +07:00
2026-10-23 23:08:48 +07:00
2026-10-30 00:13:27 +07:00
2026-11-01 20:16:59 +07:00
2026-10-20 12:00:44 +07:00
2026-10-23 22:44:37 +07:00
2026-10-23 22:44:37 +07:00
2026-10-23 22:44:37 +07:00
2026-11-11 21:21:19 +07:00
2026-10-20 12:00:44 +07:00
2026-11-17 11:55:17 +07:00
2026-10-23 03:17:10 +07:00
2026-11-16 18:01:39 +07:00
2026-11-22 14:18:20 +07:00
2026-11-04 22:53:56 +07:00
2026-11-03 03:18:14 +07:00
2026-11-03 03:18:14 +07:00
2026-11-22 00:34:47 +07:00
2026-10-20 12:00:44 +07:00
2026-11-17 02:06:37 +07:00
2026-11-01 21:24:57 +07:00
2026-11-08 15:36:33 +07:00
2026-11-21 22:00:40 +07:00
2026-10-23 22:43:23 +07:00
2026-10-31 22:36:57 +07:00
2026-11-22 14:18:20 +07:00
2026-11-20 21:35:36 +07:00
2026-10-24 03:27:23 +07:00
2026-10-23 03:59:29 +07:00
2026-10-23 22:28:48 +07:00
2026-11-16 16:09:44 +07:00
2026-10-30 18:55:58 +07:00
2026-11-20 02:17:59 +07:00
2026-11-01 19:41:07 +07:00
2026-10-20 12:00:44 +07:00
2026-11-19 15:28:12 +07:00
2026-11-17 02:06:37 +07:00
2026-10-24 03:27:23 +07:00
2026-11-21 22:02:09 +07:00
2026-10-31 01:20:41 +07:00
2026-11-03 03:18:14 +07:00
2026-11-17 02:06:37 +07:00
2026-11-21 22:02:09 +07:00
2026-11-01 20:55:22 +07:00
2026-11-21 15:13:46 +07:00
2026-11-21 12:36:12 +07:00
2026-11-17 02:06:37 +07:00
2026-10-26 04:07:26 +07:00
2026-11-22 00:17:34 +07:00
2026-11-22 03:34:12 +07:00
2026-11-01 23:18:36 +07:00
2026-10-26 01:33:56 +07:00
2026-11-01 19:30:14 +07:00
2026-11-06 20:53:20 +07:00
2026-11-22 03:34:12 +07:00
2026-11-17 02:06:37 +07:00
2026-11-18 21:48:21 +07:00
2026-11-17 02:06:37 +07:00
2026-11-18 21:48:21 +07:00
2026-11-16 21:31:23 +07:00
2026-10-31 22:14:06 +07:00
2026-11-05 22:47:33 +07:00
2026-10-31 01:14:39 +07:00
2026-10-20 16:55:01 +07:00
2026-11-05 22:47:33 +07:00
2026-11-17 02:06:37 +07:00
2026-11-15 18:04:21 +07:00
2026-11-01 20:59:45 +07:00
2026-10-20 12:00:44 +07:00
2026-11-17 11:55:17 +07:00
2026-10-23 22:43:23 +07:00
2026-11-08 15:36:33 +07:00
2026-11-08 16:49:40 +07:00
2026-11-19 18:40:22 +07:00
2026-11-21 21:20:02 +07:00
2026-11-07 20:12:16 +07:00
2026-11-11 01:52:25 +07:00
2026-10-30 15:19:26 +07:00
2026-11-20 22:05:13 +07:00
2026-11-04 15:30:25 +07:00
2026-11-11 01:52:25 +07:00
2026-11-19 17:48:48 +07:00
2026-11-22 00:19:10 +07:00
2026-11-21 22:05:01 +07:00
2026-10-26 01:33:56 +07:00
2026-10-26 01:33:56 +07:00
2026-10-20 12:00:44 +07:00
2026-10-20 12:00:44 +07:00
2026-10-17 11:45:53 +07:00
2026-11-03 13:17:12 +07:00
2026-10-20 13:38:13 +07:00
2026-10-20 12:00:44 +07:00
2026-10-03 04:27:47 +07:00
2026-10-20 12:00:44 +07:00
2026-11-15 17:39:07 +07:00
2026-10-31 22:07:30 +07:00
2026-10-25 16:58:21 +07:00
2026-11-01 17:35:49 +07:00
2026-11-15 17:39:07 +07:00
2026-11-01 19:21:10 +07:00
2026-11-03 03:18:14 +07:00
2026-11-19 17:33:57 +07:00
2026-11-11 23:29:21 +07:00
2026-11-15 17:35:24 +07:00
2026-11-04 04:04:18 +07:00
2026-11-15 21:51:30 +07:00
2026-11-01 16:38:13 +07:00
2026-11-22 03:20:45 +07:00
2026-10-31 22:07:30 +07:00
2026-11-11 16:07:11 +07:00
2026-11-21 14:46:57 +07:00
2026-11-17 03:09:29 +07:00
2026-11-21 22:05:01 +07:00
2026-11-08 16:45:26 +07:00
2026-11-18 21:48:21 +07:00
2026-10-20 12:00:44 +07:00
2026-11-01 21:29:52 +07:00
2026-10-20 00:39:08 +07:00
2026-10-20 12:00:44 +07:00
2026-10-20 16:55:01 +07:00
2026-11-03 00:38:01 +07:00
2026-11-17 08:50:36 +07:00
2026-10-31 22:36:57 +07:00
2026-11-01 20:16:59 +07:00
2026-11-15 23:33:29 +07:00
2026-10-23 22:44:37 +07:00
2026-11-16 16:03:33 +07:00
2026-11-01 20:30:50 +07:00
2026-11-08 16:33:35 +07:00
2026-11-15 18:04:21 +07:00
2026-11-15 18:04:21 +07:00
2026-11-17 09:40:22 +07:00
2026-10-25 05:56:55 +07:00
2026-10-23 22:44:37 +07:00
2026-10-19 00:56:52 +07:00
2026-11-16 16:17:06 +07:00
2026-10-20 13:44:30 +07:00
2026-10-19 00:56:52 +07:00
2026-11-04 01:35:52 +07:00
2026-11-22 00:34:47 +07:00
2026-10-25 23:36:14 +07:00
2026-11-07 18:36:18 +07:00
2026-10-25 23:36:14 +07:00
2026-10-25 23:36:14 +07:00
2026-11-17 11:55:17 +07:00
2026-11-04 15:26:45 +07:00
2026-11-01 20:59:45 +07:00
2026-11-09 02:41:48 +07:00
2026-11-22 14:18:20 +07:00
2026-10-31 22:36:57 +07:00
2026-10-20 12:00:44 +07:00
2026-11-18 21:48:21 +07:00
2026-10-20 16:55:01 +07:00
2026-11-20 21:35:36 +07:00
2026-11-01 20:30:50 +07:00
2026-10-23 22:35:26 +07:00
2026-10-20 17:44:49 +07:00
2026-09-06 16:03:46 +07:00
2026-11-06 20:53:20 +07:00
2026-11-05 22:47:33 +07:00