-
Notifications
You must be signed in to change notification settings - Fork 218
fix: managed workflow result is available even when exception is thrown #2552
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
Conversation
Fixes #2551 Signed-off-by: Chris Laprun <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@metacosm I made some comments, what is the intention regarding v5? Is this a problem also there? I'm fine with this only if we in v5 won't be handled this way, especially with the context value.
@@ -102,6 +105,8 @@ public WorkflowCleanupResult cleanup(P primary, Context<P> context) { | |||
WorkflowCleanupExecutor<P> workflowCleanupExecutor = | |||
new WorkflowCleanupExecutor<>(this, primary, context); | |||
var result = workflowCleanupExecutor.cleanup(); | |||
context.managedDependentResourceContext() | |||
.put(DefaultManagedDependentResourceContext.CLEANUP_RESULT_KEY, result); | |||
if (throwExceptionAutomatically) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't rather only this throw removed?
It seems to be redundant. If I remember correctly I was solving this for v5, there it seems to have different structure now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's slightly different in v5 but the problem is still present in a somewhat different form, though.
@Override | ||
public Optional<WorkflowReconcileResult> getWorkflowReconcileResult() { | ||
return Optional.ofNullable(workflowReconcileResult); | ||
return get(RECONCILE_RESULT_KEY, WorkflowReconcileResult.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should solve this this way (with the context map), only if there is no other way around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's not super nice but the current way is not great either (casting to the implementation, which is not a given, especially during tests since it breaks with mocks). I actually had a different implementation initially but I would like to remove the reliance on a specific implementation and a cast to it because I don't think it's a nice design.
Fixes #2551
Signed-off-by: Chris Laprun [email protected]