mirror of
https://github.com/tursom/TursomServer.git
synced 2025-02-10 03:40:51 +08:00
add fastSlowTicker
This commit is contained in:
parent
b94956cabc
commit
e11da44ac9
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user