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:07 UTC

[camel-k-runtime] branch main 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 main
in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git


The following commit(s) were added to refs/heads/main by this push:
     new 1a5e48ff fix(cron): gracefully stop when all exchanges are processed
1a5e48ff is described below

commit 1a5e48ff3a7ae551b53af0df53ffc8654109e2a9
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;
         }
     }
 }