Do not fail workflow task if an error occurs when marking it as completed #210
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It's possible for a workflow task to fail to complete even during normal operation. For example, if a signal is added to the workflow history concurrently with a workflow task attempting to complete the workflow then the
RespondWorkflowTaskCompleted
call will recieve anInvalidArgument
error with anUnhandledCommand
cause.If this happens then the Ruby SDK would get this error and then try and fail the workflow task due to how the
rescue
block encompasses the completion function. This would then lead to theRespondWorkflowTaskFailed
call failing because the server doesn't recognize the task anymore. This is because the task was actually finalized when the originalRespondWorkflowTaskCompleted
call was made and so it should not be interacted with anymore.This PR catches the
RespondWorkflowTaskCompleted
error sooner (similar to the query branch) so that it does not cause the workflow task to be failed and therefore avoids theWorkflow task not found
error from theRespondWorkflowTaskFailed
call. The error is still logged and passed to the error reporter though.