Skip to content

Commit

Permalink
feat: remove execution if a given operation completes with an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Vazquez committed Jul 11, 2024
1 parent 9ba9965 commit adb6bf6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ExecutionLevelDispatchedState(
* for example:
* parsing, validation, execution errors
* persisted query errors
* an exception during execution was thrown
*/
private fun removeExecution(executionId: ExecutionId) {
if (executions.containsKey(executionId)) {
Expand All @@ -70,10 +71,8 @@ class ExecutionLevelDispatchedState(
}
return object : SimpleInstrumentationContext<ExecutionResult>() {
override fun onCompleted(result: ExecutionResult?, t: Throwable?) {
result?.let {
if (result.errors.size > 0) {
removeExecution(parameters.executionInput.executionId)
}
if ((result != null && result.errors.size > 0) || t != null) {
removeExecution(parameters.executionInput.executionId)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class SyncExecutionExhaustedState(
* for example:
* - parsing, validation errors
* - persisted query errors
* - an exception during execution was thrown
*/
private fun removeExecution(executionId: ExecutionId) {
if (executions.containsKey(executionId)) {
Expand All @@ -73,10 +74,8 @@ class SyncExecutionExhaustedState(
}
return object : SimpleInstrumentationContext<ExecutionResult>() {
override fun onCompleted(result: ExecutionResult?, t: Throwable?) {
result?.let {
if (result.errors.size > 0) {
removeExecution(parameters.executionInput.executionId)
}
if ((result != null && result.errors.size > 0) || t != null) {
removeExecution(parameters.executionInput.executionId)
}
}
}
Expand Down

0 comments on commit adb6bf6

Please sign in to comment.