davsclaus opened a new pull request, #28778: URL: https://github.com/apache/camel/pull/28778
[CAMEL-26443](https://issues.apache.org/jira/browse/CAMEL-26443) The launcher of the web installer checks once a day for a newer release: with a cache older than 24 hours, a daemon thread fetches `latest.properties` and then writes `update-check.properties`. Since the startup work of CAMEL-23810, a quick command (`camel version`, `camel ps`, about 170 ms) ends before that thread has even sent its request. The JVM stops it and nothing is written, so a user who only runs quick commands never sees the notice of a new release, and every quick command starts the fetch again. Only a long command (`camel run`, `camel tui`) refreshed the cache. ## Changes - `UpdateChecker` marks the check (`last_checked`, and the target) **before** the fetch, so a failed or slow fetch is not tried again by the next commands, but the next day. A failed fetch keeps the version of the check before, as it did. - `UpdateChecker.awaitRefresh()`, called by `CamelLauncherMain.postExecute`, waits after the command for the fetch that this process started, at most 2 seconds. It waits only on the run that started the fetch, so once a day; after a long command the fetch is already done. - `ManifestFetcher` is `AutoCloseable` and closes its `HttpClient`, which the check does after the fetch: the selector thread of the client delays the exit of the JVM by about 300 ms (as in #28762). ## Measured `camel version` of a web installer install, JDK 25, median of 7, against a manifest server of the test that answers in 50 ms: | | before | this PR | |---|---|---| | fresh cache (no check) | 180 ms | 180 ms | | stale cache (the run of the day) | 180 ms, no request sent, cache not refreshed | 302 ms, cache refreshed (615 ms without closing the client) | ## Tests - `UpdateCheckRefreshTest` runs `camel version` of a web installer install in a new JVM against an `HttpServer` of the test: a stale cache is refreshed by the command (one request, `latest_version` from the server); after a failed fetch (HTTP 500) the next command does not fetch again and the version of the check before is kept. Without the wait in `postExecute` both fail with no request at all. - Ran locally: the camel-launcher suite (`UpdateCheckerTest`, `SelfUpdateIntegrationTest`, `LauncherStartupLoggingTest`, ...). _Claude Code on behalf of davsclaus (Claus Ibsen)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0128ThHB3iQdrvSRLVBGRrdP -- 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]
