mirror of
https://github.com/tursom/TursomServer.git
synced 2026-08-19 09:33:28 +08:00
add fastSlowTicker
This commit is contained in:
@@ -265,6 +265,7 @@ fun bufferTicker(
|
||||
fun fastSlowTicker(
|
||||
fastTicker: ReceiveChannel<Unit>,
|
||||
slowTicker: ReceiveChannel<Unit>,
|
||||
maxFailure: Int = 5,
|
||||
) = GlobalScope.produce {
|
||||
var failure = 0
|
||||
while (true) {
|
||||
@@ -276,7 +277,7 @@ fun fastSlowTicker(
|
||||
}
|
||||
|
||||
failure++
|
||||
if (failure < 5) {
|
||||
if (failure < maxFailure) {
|
||||
send(fastTicker.receive())
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user