davsclaus commented on code in PR #28040:
URL: https://github.com/apache/camel/pull/28040#discussion_r4306153383
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/HeaderChecks.java:
##########
@@ -57,6 +57,15 @@ private HeaderChecks() {
*/
static final Map<String, String> METADATA_OPTION = Map.of("timer",
"includeMetadata");
+ /**
+ * A comparison of the timer's counter with a number: the counter counts
the fires from 1, so {@code == 0} is never
+ * true (CAMEL-25744: in 8 of 10 benchmark runs a model compared it with 0
to pick the first fire). The Simple forms
+ * (${exchangeProperty.CamelTimerCounter} == 0, ${header.CamelTimerCounter
== 0 ? ...}) and the Groovy ones
+ * (exchange.getProperty('CamelTimerCounter', Integer) == 0).
+ */
+ static final Pattern TIMER_COUNTER_COMPARISON = Pattern.compile(
+
"CamelTimerCounter(?:\\}|['\"]\\s*(?:,\\s*[\\w.]+\\s*)?\\))?\\s*(==|!=|<=|<)\\s*['\"]?(\\d+)['\"]?");
+
Review Comment:
Right: `> 0`, `>= 0` and `>= 1` are always true as well. Added in
0428ceaf55d7, with a test
(`aTimerCounterComparisonThatIsAlwaysTrueIsReported`). `> 1` and `>= 2` stay
quiet. This also covers the suggestion in the other thread.
_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]