Skip to content

Commit 406781f

Browse files
authored
fix: adding thinking delay before sending hungry again (#40)
1 parent 3f4dc92 commit 406781f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

diningPhilosophers/src/main/kotlin/ac/at/uibk/dps/dapr/philosophers/philosopher/PhilosopherActorImpl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ class PhilosopherActorImpl(runtimeContext: ActorRuntimeContext<PhilosopherActorI
4444
metricsRegistry.counter("philosopher.meals").inc(1L)
4545

4646
client.publishEvent("pubsub", "release", getMap()).subscribe()
47+
48+
thinking()
49+
}
50+
51+
private fun thinking() {
52+
Thread.sleep(randomAround(10, 2).toLong())
4753
client.publishEvent("pubsub", "hungry", getMap()).subscribe()
4854
}
4955

0 commit comments

Comments
 (0)