Skip to content

fix(ServerManager): replace hardcoded sleep(1) with polling loop (#155)#179

Merged
s2x merged 2 commits intomasterfrom
fix-155-servermanager-status-polling
May 2, 2026
Merged

fix(ServerManager): replace hardcoded sleep(1) with polling loop (#155)#179
s2x merged 2 commits intomasterfrom
fix-155-servermanager-status-polling

Conversation

@s2x
Copy link
Copy Markdown
Collaborator

@s2x s2x commented May 2, 2026

Summary

  • Replace sleep(1) in ServerManager::getStatus() with a polling loop that checks every 50ms for the status file
  • Add status_timeout config option (default 5s) to make the timeout configurable (follows stop_timeout pattern)
  • Extract waitForFile() and getStatusTimeout() private methods for clean separation
  • Add 5 unit tests covering: existing file, timeout, file-appears-during-polling, default config, custom config

Test Plan

  • composer test — 334 tests, 1016 assertions, 0 failures (1 pre-existing HttpRequestHandlerTest error unrelated to this change)
  • composer lint — CS fixer, phpstan, rector all pass

Closes #155

Comment thread src/ServerManager.php
Comment thread src/ServerManager.php
@s2x s2x merged commit f41a53b into master May 2, 2026
22 checks passed
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.

ServerManager::getStatus() uses hardcoded sleep(1) — race condition

1 participant