Skip to content

Support Puma >= 7 in the puma plugin - #3

Merged
tomascco merged 1 commit into
mainfrom
puma-7-plugin-support
May 22, 2026
Merged

Support Puma >= 7 in the puma plugin#3
tomascco merged 1 commit into
mainfrom
puma-7-plugin-support

Conversation

@tomascco

Copy link
Copy Markdown
Owner

Context

lib/puma/plugin/litestream.rb was copied from an old solid_queue commit and registers lifecycle hooks via launcher.events.on_booted / on_stopped / on_restart. Puma 7 (puma#3438) renamed these hooks, so on Puma >= 7 Litestream replication was never started or stopped alongside Puma.

Change

Version-gate on Puma::Const::VERSION, mirroring solid_queue main (PR rails/solid_queue#635):

Puma < 7 Puma >= 7
on_booted after_booted
on_stopped after_stopped
on_restart before_restart

The fork + monitor setup is extracted into a private start_litestream method shared by both branches. Puma < 7 keeps the old hook names, so existing users are unaffected.

solid_queue's :async DSL mode and its extra guards are intentionally not ported — they exist there only because it moved in_background out of the booted block. Litestream always forks an external binary, so in_background stays inside start_litestream (after the pid is assigned) and no nil-pid guard is needed.

Verification

No puma dependency is declared in the gemspec and no plugin test exists, so this is a manual check:

  • ruby -c lib/puma/plugin/litestream.rb — syntax OK
  • Boot a dummy app with plugin :litestream under Puma 7; confirm replication starts on boot and stops on restart, with no undefined method / deprecation warnings
  • Repeat under Puma 6 to confirm the on_* branch still works

🤖 Generated with Claude Code

Puma 7 (puma#3438) renamed the lifecycle event hooks the plugin relies
on, so on Puma >= 7 Litestream replication was never started or stopped
alongside Puma.

Version-gate on Puma::Const::VERSION, mirroring solid_queue:

  on_booted  -> after_booted
  on_stopped -> after_stopped
  on_restart -> before_restart

Puma < 7 keeps the old hook names, so existing users are unaffected. The
fork + monitor setup is extracted into a private start_litestream method
shared by both branches.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@tomascco
tomascco merged commit ad58374 into main May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant