Skip to content

Commit

Permalink
Update oolong (fixes serialization problems)
Browse files Browse the repository at this point in the history
  • Loading branch information
danslapman committed Jan 18, 2025
1 parent 49bfe89 commit d4ab7da
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ final class AdminApiHandler(
service: Option[String],
labels: List[String]
): RIO[WLD, Vector[HttpStub]] = {
val basePred = query[HttpStub](hs => hs.scope != lift(Scope.Countdown) || hs.times.!! > 0)
val basePred = query[HttpStub](hs => hs.scope != lift(Scope.Countdown.asInstanceOf[Scope]) || hs.times.!! > 0)

val queryPart = queryString.map(qs =>
query[HttpStub](hs =>
Expand Down Expand Up @@ -269,7 +269,7 @@ final class AdminApiHandler(
service: Option[String],
labels: List[String]
): RIO[WLD, Vector[Scenario]] = {
val basePred = query[Scenario](s => s.scope != lift(Scope.Countdown) || s.times.!! > 0)
val basePred = query[Scenario](s => s.scope != lift(Scope.Countdown.asInstanceOf[Scope]) || s.times.!! > 0)

val queryPart = queryString.map(qs =>
query[Scenario](s =>
Expand Down Expand Up @@ -434,7 +434,7 @@ final class AdminApiHandler(
): RIO[WLD, Vector[GrpcStubView]] =
for {
scopeQuery <- ZIO.succeed(
query[GrpcStub](gs => gs.scope != lift(Scope.Countdown) && gs.times.!! > 0)
query[GrpcStub](gs => gs.scope != lift(Scope.Countdown.asInstanceOf[Scope]) && gs.times.!! > 0)
)
nameDescriptions <- ZIO
.foreach(queryString) { qs =>
Expand Down Expand Up @@ -785,7 +785,7 @@ final class AdminApiHandler(
queryString: Option[String],
labels: List[String]
): RIO[WLD, Vector[GrpcStub]] = {
val baseQuery = query[GrpcStub](gs => gs.scope != lift(Scope.Countdown) || gs.times.!! > 0)
val baseQuery = query[GrpcStub](gs => gs.scope != lift(Scope.Countdown.asInstanceOf[Scope]) || gs.times.!! > 0)

val queryPart = queryString.map(qs =>
query[GrpcStub](gs =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import scala.xml.Node

import io.circe.Json
import mouse.option.*
import oolong.bson.*
import oolong.bson.given
import oolong.dsl.*
import oolong.mongo.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,41 @@ final class EphemeralCleaner(
threshold = current.minusSeconds(secondsInDay)
deleted <- stubDAO.delete(
query[HttpStub](hs =>
Set[Scope](lift(Scope.Ephemeral), lift(Scope.Countdown)).contains(hs.scope) && hs.created.isBefore(
Set[Scope](lift(Scope.Ephemeral.asInstanceOf[Scope]), lift(Scope.Countdown.asInstanceOf[Scope]))
.contains(hs.scope) && hs.created.isBefore(
lift(threshold)
)
)
)
_ <- log.info("Purging expired stubs: {} deleted", deleted)
deleted2 <- scenarioDAO.delete(
query[Scenario](s =>
Set[Scope](lift(Scope.Ephemeral), lift(Scope.Countdown)).contains(s.scope) && s.created.isBefore(
Set[Scope](lift(Scope.Ephemeral.asInstanceOf[Scope]), lift(Scope.Countdown.asInstanceOf[Scope]))
.contains(s.scope) && s.created.isBefore(
lift(threshold)
)
)
)
_ <- log.info("Purging expired scenarios: {} deleted", deleted2)
deleted3 <- grpcStubDAO.delete(
query[GrpcStub](gs =>
Set[Scope](lift(Scope.Ephemeral), lift(Scope.Countdown)).contains(gs.scope) && gs.created.isBefore(
Set[Scope](lift(Scope.Ephemeral.asInstanceOf[Scope]), lift(Scope.Countdown.asInstanceOf[Scope]))
.contains(gs.scope) && gs.created.isBefore(
lift(threshold)
)
)
)
_ <- log.info("Purging expired grpc stubs: {} deleted", deleted3)
deleted4 <- stubDAO.delete(
query[HttpStub](hs => hs.scope == lift(Scope.Countdown) && hs.times.!! <= 0)
query[HttpStub](hs => hs.scope == lift(Scope.Countdown.asInstanceOf[Scope]) && hs.times.!! <= 0)
)
_ <- log.info("Purging countdown stubs: {} deleted", deleted4)
deleted5 <- scenarioDAO.delete(
query[Scenario](s => s.scope == lift(Scope.Countdown) && s.times.!! <= 0)
query[Scenario](s => s.scope == lift(Scope.Countdown.asInstanceOf[Scope]) && s.times.!! <= 0)
)
_ <- log.info("Purging countdown scenarios: {} deleted", deleted5)
deleted6 <- grpcStubDAO.delete(
query[GrpcStub](gs => gs.scope == lift(Scope.Countdown) && gs.times.!! <= 0)
query[GrpcStub](gs => gs.scope == lift(Scope.Countdown.asInstanceOf[Scope]) && gs.times.!! <= 0)
)
_ <- log.info("Purging countdown grpc stubs: {} deleted", deleted6)
} yield deleted
Expand Down
2 changes: 1 addition & 1 deletion backend/project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ object Dependencies {
"oolong-bson",
"oolong-bson-refined",
"oolong-mongo",
).map("io.github.leviysoft" %% _ % "0.4.4")
).map("io.github.leviysoft" %% _ % "0.5.0")

lazy val logback = Seq(
"logback-core",
Expand Down

0 comments on commit d4ab7da

Please sign in to comment.