Replace blocking command execution with async libevent-driven dispatch#3
Draft
Copilot wants to merge 2 commits into
Draft
Replace blocking command execution with async libevent-driven dispatch#3Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Co-authored-by: Blazzzeee <148184733+Blazzzeee@users.noreply.github.com> Agent-Logs-Url: https://github.com/Blazzzeee/CMon/sessions/bfbb5b9c-9a75-48c0-bcaf-c48bf5a63c45
Copilot
AI
changed the title
[WIP] Make command execution non-blocking for improved performance
Replace blocking command execution with async libevent-driven dispatch
Mar 25, 2026
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.
run_cmd_argvblocked the entire libevent event loop for the duration of every child process via a synchronous pipe-read loop and two blockingwaitpidcalls. A slowgit pullor./deploy.shstarved all concurrent requests.Changes
commands.cwaitpidcalls and the synchronous pipe-read loop.commands_set_event_base(base)— registers aSIGCHLDhandler viaevsignal_newthat reaps all finished children usingwaitpid(-1, &status, WNOHANG).pipe_drain_cb— libeventEV_READ | EV_PERSISTcallback drains child output as it arrives; self-destructs (event_del→event_free→close) on EOF/error.run_cmd_argv— forks, sets the read-endO_NONBLOCK, registers the drain event, and returns immediately withexit_code=0and an empty arena string. Output is drained by the event loop and not surfaced to callers (groundwork for job queue offload).commands.hcommands_set_event_base(struct event_base *)declaration with a forward declaration forstruct event_baseto avoid pulling in libevent headers.run_cmd_argvdoc comment to document the async contract.main.ccommands_set_event_base(base)immediately afterevent_base_new(). Route table, endpoints, and auth middleware untouched.Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.