Skip to content

Commit

Permalink
fix workflow not found issue
Browse files Browse the repository at this point in the history
Signed-off-by: Surya Sashank Nistala <[email protected]>
  • Loading branch information
eirsep committed Jul 7, 2023
1 parent 0c43fef commit 28043af
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,31 @@ class TransportAcknowledgeChainedAlertAction @Inject constructor(
?: recreateObject(AcknowledgeChainedAlertRequest) { AcknowledgeChainedAlertRequest(it) }
client.threadPool().threadContext.stashContext().use {
scope.launch {
val getWorkflowResponse: GetWorkflowResponse =
transportGetWorkflowAction.client.suspendUntil {
val getWorkflowRequest = GetWorkflowRequest(workflowId = request.workflowId, method = RestRequest.Method.GET)
try {
val getWorkflowResponse: GetWorkflowResponse =
transportGetWorkflowAction.client.suspendUntil {
val getWorkflowRequest = GetWorkflowRequest(workflowId = request.workflowId, method = RestRequest.Method.GET)

execute(AlertingActions.GET_WORKFLOW_ACTION_TYPE, getWorkflowRequest, it)
}
if (getWorkflowResponse.workflow == null) {
actionListener.onFailure(
AlertingException.wrap(
ResourceNotFoundException(
String.format(
Locale.ROOT,
"No workflow found with id [%s]",
request.workflowId
execute(AlertingActions.GET_WORKFLOW_ACTION_TYPE, getWorkflowRequest, it)
}
if (getWorkflowResponse.workflow == null) {
actionListener.onFailure(
AlertingException.wrap(
ResourceNotFoundException(
String.format(
Locale.ROOT,
"No workflow found with id [%s]",
request.workflowId
)
)
)
)
)
} else {
AcknowledgeHandler(client, actionListener, request).start(getWorkflowResponse.workflow!!)
} else {
AcknowledgeHandler(client, actionListener, request).start(getWorkflowResponse.workflow!!)
}
} catch (e: Exception) {
log.error("Failed to acknowledge chained alerts from request $request", e)
actionListener.onFailure(AlertingException.wrap(e))
}
}
}
Expand Down

0 comments on commit 28043af

Please sign in to comment.