Skip to content

fix: interruption of a workflow #1883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import org.slf4j.Logger;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.javaoperatorsdk.operator.OperatorException;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.api.reconciler.dependent.DependentResource;
import io.javaoperatorsdk.operator.processing.event.ResourceID;

@SuppressWarnings("rawtypes")
public abstract class AbstractWorkflowExecutor<P extends HasMetadata> {
Expand Down Expand Up @@ -46,8 +48,14 @@ protected synchronized void waitForScheduledExecutionsToRun() {
logger().warn("Notified but still resources under execution. This should not happen.");
}
} catch (InterruptedException e) {
logger().warn("Thread interrupted", e);
Thread.currentThread().interrupt();
if (noMoreExecutionsScheduled()) {
logger().debug("interrupted, no more executions for: {}",
ResourceID.fromResource(primary));
return;
} else {
logger().error("Thread interrupted for primary: {}", ResourceID.fromResource(primary), e);
throw new OperatorException(e);
}
}
}
}
Expand Down