Claus Ibsen created CAMEL-25042:
-----------------------------------
Summary: Dev mode reload: the scan should skip dot directories, so
camel-jbang's own state file does not reload the routes
Key: CAMEL-25042
URL: https://issues.apache.org/jira/browse/CAMEL-25042
Project: Camel
Issue Type: Bug
Components: camel-core
Reporter: Claus Ibsen
The reload scan of CAMEL-25041 walks the watched folder every scan, including
its dot directories. Two consequences.
*camel-jbang reloads the routes because of its own state file.* {{camel run}}
keeps the properties of the run it is doing in
{{.camel-jbang/camel-jbang-run.properties}} and writes it more than once while
starting. The scan reports each write, the file ends in {{.properties}} so the
strategy treats it as a properties change, and the routes are reloaded for it.
Measured on the same example before and after CAMEL-25041:
{noformat}
WatchService (10 s poll): 1 "Reloading properties:
.../.camel-jbang/camel-jbang-run.properties"
scan (1 s): 2
{noformat}
The 10 s poll coalesced both writes into one batch, so it happened once and was
merely pointless. At 1 s they are two changes, so the application reloads twice
a second apart, and that is not harmless: an example whose file consumer calls
a rest route in the same application had the in-flight call answered 404 by a
rest route that was being torn down and rebuilt by the second reload.
{noformat}
11:15:12.227 INFO Routes reloaded summary (total:2 started:2)
11:15:13.230 ERROR HTTP operation failed invoking
http://localhost:8080/stock/CAMEL-MUG with statusCode: 404
11:15:14.248 INFO Routes reloaded summary (total:2 started:2)
{noformat}
*And it costs.* Registering directories once, as the watch service did, meant
the size of {{.git}} did not matter. A scan every second does: {{camel run
--source-dir}} on a checkout walks the whole history directory for nothing.
A dot directory holds state, not sources, so the scan skips it -- as it already
skips the compile work directory (CAMEL-24862). {{.camel-jbang}}, {{.camel}},
{{.git}} and {{.idea}} are then all out of the way. A route file inside a dot
directory is no longer watched, which is the intended consequence.
Found while checking the reload change against the local-model benchmark: the
extra reload made one rung of the ladder fail for a reason that had nothing to
do with the model.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)