File tree 1 file changed +3
-3
lines changed
manager/src/main/scala/com/devsisters/shardcake
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -48,10 +48,10 @@ class ShardManager(
48
48
ZIO .fail(new RuntimeException (s " Pod $pod is not healthy, refusing to register " ))
49
49
)
50
50
51
- def notifyUnhealthyPod (podAddress : PodAddress ): UIO [Unit ] =
51
+ def notifyUnhealthyPod (podAddress : PodAddress , ignoreMetric : Boolean = false ): UIO [Unit ] =
52
52
ZIO
53
53
.whenZIODiscard(stateRef.get.map(_.pods.contains(podAddress))) {
54
- ManagerMetrics .podHealthChecked.tagged(" pod_address" , podAddress.toString).increment *>
54
+ ManagerMetrics .podHealthChecked.tagged(" pod_address" , podAddress.toString).increment.unless(ignoreMetric) *>
55
55
eventsHub.publish(ShardingEvent .PodHealthChecked (podAddress)) *>
56
56
ZIO .unlessZIO(healthApi.isAlive(podAddress))(
57
57
ZIO .logWarning(s " Pod $podAddress is not alive, unregistering " ) *> unregister(podAddress)
@@ -61,7 +61,7 @@ class ShardManager(
61
61
def checkAllPodsHealth : UIO [Unit ] =
62
62
for {
63
63
pods <- stateRef.get.map(_.pods.keySet)
64
- _ <- ZIO .foreachParDiscard(pods)(notifyUnhealthyPod).withParallelism(4 )
64
+ _ <- ZIO .foreachParDiscard(pods)(notifyUnhealthyPod(_, ignoreMetric = true ) ).withParallelism(4 )
65
65
} yield ()
66
66
67
67
def unregister (podAddress : PodAddress ): UIO [Unit ] =
You can’t perform that action at this time.
0 commit comments