You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pc...@apache.org on 2023/05/19 12:07:23 UTC

[camel-k-runtime] branch release-1.17.x updated: fix(cron): gracefully stop when all exchanges are processed

This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch release-1.17.x
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git


The following commit(s) were added to refs/heads/release-1.17.x by this push:
     new 18447731 fix(cron): gracefully stop when all exchanges are processed
18447731 is described below

commit 184477313c6babe690c1536ba7029e4c8071741d
Author: Pasquale Congiusti <pa...@gmail.com>
AuthorDate: Fri May 19 12:39:32 2023 +0200

    fix(cron): gracefully stop when all exchanges are processed
    
    Closes https://github.com/apache/camel-k/issues/4343
---
 .../main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java b/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
index 8616249b..dd36f0e0 100644
--- a/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
+++ b/camel-k-cron/impl/src/main/java/org/apache/camel/k/cron/CronSourceLoaderInterceptor.java
@@ -131,7 +131,8 @@ public class CronSourceLoaderInterceptor implements RouteBuilderLifecycleStrateg
 
         @Override
         public boolean isEnabled(CamelEvent event) {
-            return event instanceof CamelEvent.ExchangeCompletedEvent || event instanceof CamelEvent.ExchangeFailedEvent;
+            return (event instanceof CamelEvent.ExchangeCompletedEvent || event instanceof CamelEvent.ExchangeFailedEvent)
+                && this.runtime.getCamelContext().getInflightRepository().size() == 0;
         }
     }
 }