Skip to content

Commit

Permalink
Don't return DbBackfillRun outside of db session (#370)
Browse files Browse the repository at this point in the history
Addresses
#368 (comment)
  • Loading branch information
mhickman authored Jan 28, 2024
1 parent 5fbd6b8 commit 01be0c6
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ class StopAllBackfillsAction @Inject constructor(
// TODO check user has permissions for this service with access api
logger.info { "Stop all backfills called by ${caller.get()?.user}" }

val runningBackfills = transacter.transaction { session ->
val runningBackfillIds = transacter.transaction { session ->
queryFactory.newQuery<BackfillRunQuery>()
.state(BackfillState.RUNNING)
.list(session)
.map { it.id.id }
}

runningBackfills.forEach { backfill ->
logger.info { "Stop backfill ${backfill.id} by ${caller.get()?.user}" }
backfillStateToggler.toggleRunningState(backfill.id.id, caller.get()!!, BackfillState.PAUSED)
runningBackfillIds.forEach { backfillId ->
logger.info { "Stop backfill ${backfillId} by ${caller.get()?.user}" }
backfillStateToggler.toggleRunningState(backfillId, caller.get()!!, BackfillState.PAUSED)
}

return StopAllBackfillsResponse()
Expand Down

0 comments on commit 01be0c6

Please sign in to comment.