Load WAL checkpointer outside Zeitwerk reload; harden fork stop

Keep the module under lib/rails_ext, use before_worker_boot, shorten the
SQLite busy timeout under stop's join, and PASSIVE-checkpoint on exit for
short-lived writers.

Co-authored-by: Thomas Klemm <github@tklemm.eu>
This commit is contained in:
Cursor Agent
2026-10-07 19:05:44 +00:00
parent 61631ea5f9
commit 8704baa860
4 changed files with 38 additions and 4 deletions
+5 -2
View File
@@ -1,5 +1,8 @@
# Start a checkpoint contender in every non-test process. Puma and Resque pool
# stop before fork and start again in the child so the flock is never inherited.
# Loaded from lib/rails_ext (autoload_lib ignore list) so reloads do not orphan
# the contender thread. Non-test processes start here; Puma/Resque stop before
# fork and start again in the child.
require Rails.root.join("lib/rails_ext/sqlite_wal_checkpoint")
Rails.application.config.after_initialize do
SqliteWalCheckpoint.start unless Rails.env.test?
end