davsclaus commented on code in PR #29878:
URL: https://github.com/apache/camel/pull/29878#discussion_r4568090634


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/ActionBaseCommand.java:
##########
@@ -64,18 +64,19 @@ protected static JsonObject getJsonObject(Path outputFile, 
long timeout) {
         while (watch.taken() < timeout) {
             File f = outputFile.toFile();
             try {
-                // give time for response to be ready
-                Thread.sleep(100);
-
                 if (Files.exists(outputFile) && f.length() > 0) {
                     String text = Files.readString(outputFile);
                     return (JsonObject) Jsoner.deserialize(text);
                 }
+            } catch (Exception e) {
+                // not all written yet
+            }

Review Comment:
   Keeping this as it is. The catch is not new: before this PR the same 
exceptions fell into the old `catch (Exception e) { // ignore }`. The PR only 
moves the sleep out of that try, so an `InterruptedException` is handled on its 
own. The action commands have no logger; the CLI writes to the terminal through 
`printer()`, so a TRACE log would not be seen anyway. Since #29830 
(cli-connector: answers written aside and moved in place), the connector moves 
the answer into place in one step, so a half-written file can only come from an 
older integration. An answer that never parses ends the wait as "no reply in 
time", as it did before.
   
   _Claude Code on behalf of davsclaus_



-- 
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]

Reply via email to