Skip to content

Commit 4d21ab8

Browse files
committed
getUpdateAppTransaction
1 parent e677821 commit 4d21ab8

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/LeoAppServiceInterp.scala

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import org.broadinstitute.dsde.workbench.leonardo.JsonCodec._
2929
import org.broadinstitute.dsde.workbench.leonardo.SamResourceId._
3030
import org.broadinstitute.dsde.workbench.leonardo.config._
3131
import org.broadinstitute.dsde.workbench.leonardo.dao.{WsmApiClientProvider, WsmDao}
32+
import org.broadinstitute.dsde.workbench.leonardo.db.DBIOInstances.dbioInstance
3233
import org.broadinstitute.dsde.workbench.leonardo.db.KubernetesServiceDbQueries.getActiveFullAppByWorkspaceIdAndAppName
3334
import org.broadinstitute.dsde.workbench.leonardo.db._
3435
import org.broadinstitute.dsde.workbench.leonardo.http.service.LeoAppServiceInterp.{
@@ -669,22 +670,18 @@ final class LeoAppServiceInterp[F[_]: Parallel](config: AppServiceConfig,
669670
.raiseError[Unit](AppNotFoundByWorkspaceIdException(workspaceId, appName, ctx.traceId, "permission denied"))
670671
} yield GetAppResponse.fromDbResult(app, Config.proxyConfig.proxyUrlBase)
671672

672-
private def updateAppInternal(appId: AppId, validatedChanges: UpdateAppRequest): F[Unit] = for {
673+
private def getUpdateAppTransaction(appId: AppId, validatedChanges: UpdateAppRequest): F[Unit] = (for {
673674
_ <- validatedChanges.autodeleteEnabled.traverse(enabled =>
674675
appQuery
675676
.updateAutodeleteEnabled(appId, enabled)
676-
.transaction
677-
.void
678677
)
679678

680679
// note: does not clear the threshold if None. This only sets defined thresholds.
681680
_ <- validatedChanges.autodeleteThreshold.traverse(threshold =>
682681
appQuery
683682
.updateAutodeleteThreshold(appId, Some(threshold))
684-
.transaction
685-
.void
686683
)
687-
} yield ()
684+
} yield ()).transaction
688685

689686
override def updateApp(userInfo: UserInfo, cloudContext: CloudContext.Gcp, appName: AppName, req: UpdateAppRequest)(
690687
implicit as: Ask[F, AppContext]
@@ -712,7 +709,7 @@ final class LeoAppServiceInterp[F[_]: Parallel](config: AppServiceConfig,
712709
resolvedAutodeleteEnabled = req.autodeleteEnabled.getOrElse(appResult.app.autodeleteEnabled)
713710
resolvedAutodeleteThreshold = req.autodeleteThreshold.orElse(appResult.app.autodeleteThreshold)
714711
_ <- F.fromEither(validateAutodelete(resolvedAutodeleteEnabled, resolvedAutodeleteThreshold, ctx.traceId))
715-
_ <- updateAppInternal(appResult.app.id, req)
712+
_ <- getUpdateAppTransaction(appResult.app.id, req)
716713
} yield ()
717714

718715
override def createAppV2(userInfo: UserInfo, workspaceId: WorkspaceId, appName: AppName, req: CreateAppRequest)(

0 commit comments

Comments
 (0)