Skip to content

Commit

Permalink
feat(batching): v7 remove execution if a given operation completes wi…
Browse files Browse the repository at this point in the history
…th an exception (#2007)

### 📝 Description

#2006

Co-authored-by: Samuel Vazquez <samvazquez@expediagroup.com>
  • Loading branch information
samuelAndalon and Samuel Vazquez committed Jul 11, 2024
1 parent 4bf3103 commit 3cf86d9
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 3cf86d9

Please sign in to comment.