Skip to content

Commit

Permalink
[RW-12525] Reduce autodelete monitor frequency from 2 hours to 5 minu…
Browse files Browse the repository at this point in the history
…tes (#4788)
  • Loading branch information
jmthibault79 authored Sep 27, 2024
1 parent 10af4b4 commit 3fbffee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion http/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,9 @@ autoFreeze {
}

autodelete {
autodeleteCheckInterval = 2 hours
# chosen to be significantly less than the minimum autodelete threshold (1 hour)
# offered to All of Us Researcher Workbench users
autodeleteCheckInterval = 5 minutes
}

jupyterConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import java.time.Instant
import scala.concurrent.ExecutionContext

/**
* This monitor periodically sweeps the Leo database and autodelete App that have been running for too long.
* This monitor periodically sweeps the Leo database and autodeletes Apps that have been running for too long.
*/
class AutoDeleteAppMonitor[F[_]](
config: AutoDeleteConfig,
Expand All @@ -35,8 +35,7 @@ class AutoDeleteAppMonitor[F[_]](
ec: ExecutionContext,
openTelemetry: OpenTelemetryMetrics[F]
) extends BackgroundProcess[F, AppToAutoDelete] {
override def name: String =
"autodeleteApp" //
override def name: String = "autodeleteApp"
override def interval: scala.concurrent.duration.FiniteDuration = config.autodeleteCheckInterval

override def getCandidates(now: Instant)(implicit
Expand All @@ -54,7 +53,7 @@ class AutoDeleteAppMonitor[F[_]](
_ <- a.cloudContext match {
case CloudContext.Gcp(googleProject) =>
if (a.appStatus == AppStatus.Error) {
implicit val implicitAppContext = Ask.const(AppContext(traceId, now))
implicit val implicitAppContext: Ask[F, AppContext] = Ask.const(AppContext(traceId, now))
for {
// delete kubernetes-app Sam resource
petToken <- samService.getPetServiceAccountToken(a.creator, googleProject)
Expand Down

0 comments on commit 3fbffee

Please sign in to comment.