Skip to content

Commit

Permalink
fine tune keep alive
Browse files Browse the repository at this point in the history
  • Loading branch information
avigdor-mans committed Feb 9, 2023
1 parent b0874ae commit 385bb84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object KeepAliveScheduler {
_ <- tenantRegistry.handleTenantActivityStatus(tenantId, isAlive)
} yield tenantId

policy = Schedule.recurUntilZIO[Env, String](tenantId => tenantRegistry.getTenant(tenantId).map(_.isEmpty)) && Schedule.spaced(2.seconds)
policy = Schedule.recurUntilZIO[Env, String](tenantId => tenantRegistry.getTenant(tenantId).map(_.isEmpty)) && Schedule.spaced(3.seconds)
_ <- action repeat policy
} yield ()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object SidecarServiceTest extends JUnitRunnableSpec with KafkaTestSupport with C
records1 <- sidecarUser.collectedRequests.delay(6.seconds)
_ <- assertTrue(records1.nonEmpty)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = false)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = true).delay(5.second)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = true).delay(6.second)
_ <- sidecarService.produce(ProduceRequest(context.topicName, context.payload, context.target)).delay(6.seconds)
records2 <- sidecarUser.collectedRequests.delay(6.seconds)
} yield assert(records2.size - records1.size)(equalTo(0))
Expand All @@ -64,7 +64,7 @@ object SidecarServiceTest extends JUnitRunnableSpec with KafkaTestSupport with C
records1 <- sidecarUser.collectedRequests.delay(6.seconds)
_ <- assertTrue(records1.nonEmpty)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = false)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = true).delay(2.second)
_ <- sidecarUser.updateShouldKeepAlive(keepAlive = true).delay(3.second)
_ <- sidecarService.produce(ProduceRequest(context.topicName, context.payload, context.target)).delay(6.seconds)
records2 <- sidecarUser.collectedRequests.delay(6.seconds)
} yield assertTrue((records2.size - records1.size) > 0)
Expand Down

0 comments on commit 385bb84

Please sign in to comment.