Skip to content

Run after_server_start hooks once, after the server responds - #192

Merged
rosston merged 1 commit into
mainfrom
after-server-start-run-once
Sep 17, 2026
Merged

rosston merged 1 commit into
mainfrom
after-server-start-run-once

Conversation

@rosston

@rosston rosston commented Sep 17, 2026

Copy link
Copy Markdown
Member

The hooks ran inside the loop that polls for the server to respond, so they ran once per 0.1 seconds the boot took rather than once per boot, each time before the server was known to be responding, and not at all if it responded on the first check.

Running them after the loop instead also keeps a slow hook from counting against the 60-second boot timeout. They stay inside the unless responsive? guard, so booting an already-booted server doesn't run them again.

Server now takes its initializer hooks and its Puma as arguments, so the tests can delay a real server's start without monkeypatching Server::Puma for the whole process.

Fixes #186

The hooks ran inside the loop that polls for the server to respond, so
they ran once per 0.1 seconds the boot took rather than once per boot,
each time before the server was known to be responding, and not at all
if it responded on the first check.

Running them after the loop instead also keeps a slow hook from counting
against the 60-second boot timeout. They stay inside the `unless
responsive?` guard, so booting an already-booted server doesn't run them
again.

Server now takes its initializer hooks and its Puma as arguments, so the
tests can delay a real server's start without monkeypatching
Server::Puma for the whole process.

Fixes #186
@rosston rosston self-assigned this Sep 17, 2026
@rosston
rosston merged commit cec0dbf into main Sep 17, 2026
46 checks passed
@rosston
rosston deleted the after-server-start-run-once branch September 17, 2026 19:41
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.

after_server_start hooks run once per boot poll instead of once

1 participant