Repository navigation
fix(inbound): long-poll claims inside one WordPress boot instead of booting every second - #972
Merged
Merged
Conversation
…ooting every second
Member
Author
|
Production result (Extra Chill VPS, self-upgraded to b1e4708): the inbound connector cgroup went from 14.8s CPU per 30s (49% of one core) to 2.1s CPU per 60s (3%). Load average went from about 13 to 8.3 over the same window. AI disclosure: Claude (Anthropic) in the Pi coding agent, via a Roadie session at the maintainer's direction, wrote this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The inbound event connector runs
wp coding-agents inbound pollin a loop and sleeps 1s after every empty result. So an idle runtime boots WordPress once per second, permanently. On the Extra Chill production VPS that measured 49% of one core (14.8s CPU in 30s, cgroupCPUUsageNSec), plus DB connection churn, on a host that is already under memory and IO pressure.Fix
pollaccepts--wait=<seconds>(capped at 55). Inside a single WordPress boot it retriesclaim()every 0.5s until it gets a claim or the window elapses.--wait=25, with the subprocess timeout extended to cover the window.--oncekeeps--wait=0.An idle runtime now costs one WordPress boot per 25s instead of one per second, and a newly queued event is still claimed within about 0.5s. The claim/ack/retry contract is unchanged.
Verification
python3 tests/inbound-event-connector.pyandphp tests/smoke-inbound-event-bridge.phppass.AI disclosure: Claude (Anthropic) in the Pi coding agent, via a Roadie session at the maintainer's direction, wrote this.