davsclaus opened a new pull request, #29727: URL: https://github.com/apache/camel/pull/29727
[CAMEL-25447](https://issues.apache.org/jira/browse/CAMEL-25447): the file transport of camel-cli-connector answers actions in about 100 ms instead of up to a second. This covers every client of a running integration: `camel get` / `camel cmd`, the Camel CLI dashboard, the MCP server and `camel ask`. ## Before One task on the connector's single thread ran every second (every 100 ms in debug mode). Each run checked the lock file, then looked for action files, then wrote the status, and every second run also wrote the trace and the other snapshots. So an action waited up to a second before the integration saw it. ## After - The task above is unchanged: same interval, same order, same status content. - A second task looks for action files every 100 ms. It runs on the same single-thread executor, so there is no new thread, and actions still run one at a time and in order (`actionTask` is still `synchronized`). - The extra task is only scheduled when the interval is above 100 ms. In debug mode, or after the debugger sets the delay to 100 ms, there is one task as before. - Both tasks share the lock-file and status-file guard (`polling()`). So deleting the lock file (`camel stop`) is also noticed within about 100 ms. - `updateDelay` cancels and reschedules both tasks. It only schedules them while the lock file exists; before, it could schedule a task that failed with an NPE on every run. - `doStop` cancels the new task before `awaitPoll()`, so the stop behaviour of CAMEL-26396 is unchanged. - The WebSocket transport has its own scheduler and is not affected. - Cost: 10 scans a second of `~/.camel` for `<pid>-action*.json`, measured at about 0.04 ms each in the JIRA. The extra task collects no status. Docs: the file transport section of `cli-connector.adoc` and its catalog copy say that actions are looked for about every 100 ms, while the status is written every second. ## Tests - New `FileCliConnectorTransportTest.actionsAreAnsweredBetweenTwoStatusUpdates`: with the default 1 s interval, five actions one after another are all answered within 2.5 s (Awaitility), and the status is still collected about once a second. - With the extra poll switched off, the five actions take about 5.2 s and the test fails. - `camel-cli-connector`: 111 tests pass. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
