allthingssecurity commented on PR #27302:
URL: https://github.com/apache/camel/pull/27302#issuecomment-5966441645

   Thanks for the review. All three points are addressed in 314ab43b6490:
   
   1. `KubernetesHelper.watchAgain` now catches an exception from `task.run()`, 
logs it at WARN and schedules another attempt. The delay doubles from 1s up to 
30s. Retrying stops when the consumer is no longer run-allowed or the thread is 
interrupted (executor shut down). Every new closed watch starts again at 1s, 
which resets the delay after a successful re-watch.
   2. Each consumer's watch task now checks `isRunAllowed()` right after 
assigning the new watch and closes it if the consumer was stopped during the 
handshake. The `watch` field is now `volatile`, so `doStop` and the watch task 
see each other's writes. While doing this I found that 
`KubernetesCustomResourcesConsumer` never assigned its watch, so it was not 
closed on stop either. It now assigns it, and its catch block rethrows after 
logging so that a failed re-watch is retried there too.
   3. Added 
`KubernetesPodsConsumerWatchClosedTest#testWatchAgainAfterAFailedAttemptToWatchAgain`.
 The mock server closes the first watch with 410, answers the first re-watch 
with 403 once, and then serves a watch that emits a pod. The test asserts that 
the pod event arrives and that the server saw 3 watch requests. The log shows 
the WARN for the 403 and the retry after 2000 ms. Against the previous helper, 
the test fails after the 20s mock wait. No `Thread.sleep` in the test; it uses 
the MockEndpoint wait.
   
   `mvn -pl components/camel-kubernetes install`: 157 unit tests run, 0 
failures, 6 skipped. The 43 ITs are skipped locally because they need a cluster.
   
   I did not add a dedicated test for the stop/handshake race (point 2). It 
needs a watch call blocked mid-handshake while the consumer stops, and I could 
not make that deterministic with the mock server.
   
   _Claude Code on behalf of allthingssecurity_
   


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