mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-24 22:56:48 +09:00
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:
1 parent
61631ea5f9
commit
8704baa860
4 files changed
+38
-4
No files matched your search
@@ -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
|
||||
+1
-1
@@ -54,7 +54,7 @@ Membership.disconnect_all
|
||||
# do not inherit the flock; each worker starts its own contender. Single-process
|
||||
# mode never forks, so the initializer's contender keeps running.
|
||||
before_fork { SqliteWalCheckpoint.stop }
|
||||
on_worker_boot { SqliteWalCheckpoint.start }
|
||||
before_worker_boot { SqliteWalCheckpoint.start }
|
||||
|
||||
Signal.trap :SIGPROF do
|
||||
Thread.list.each do |t|
|
||||
|
||||
Reference in new issue
Block a user