Skip to content

Commit 49c87af

Browse files
authored
fix: interruption of a workflow (#1883)
1 parent 2368c67 commit 49c87af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/AbstractWorkflowExecutor.java

+10-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
import org.slf4j.Logger;
1212

1313
import io.fabric8.kubernetes.api.model.HasMetadata;
14+
import io.javaoperatorsdk.operator.OperatorException;
1415
import io.javaoperatorsdk.operator.api.reconciler.Context;
1516
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
17+
import io.javaoperatorsdk.operator.processing.event.ResourceID;
1618

1719
@SuppressWarnings("rawtypes")
1820
public abstract class AbstractWorkflowExecutor<P extends HasMetadata> {
@@ -46,8 +48,14 @@ protected synchronized void waitForScheduledExecutionsToRun() {
4648
logger().warn("Notified but still resources under execution. This should not happen.");
4749
}
4850
} catch (InterruptedException e) {
49-
logger().warn("Thread interrupted", e);
50-
Thread.currentThread().interrupt();
51+
if (noMoreExecutionsScheduled()) {
52+
logger().debug("interrupted, no more executions for: {}",
53+
ResourceID.fromResource(primary));
54+
return;
55+
} else {
56+
logger().error("Thread interrupted for primary: {}", ResourceID.fromResource(primary), e);
57+
throw new OperatorException(e);
58+
}
5159
}
5260
}
5361
}

0 commit comments

Comments
 (0)