Skip to content

Commit

Permalink
fix hibernate schedule duration
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg committed Sep 26, 2024
1 parent 9ff1e22 commit 73bd3e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/scala/netty/ActorChannelConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.netty.channel.*
import io.netty.handler.codec.http.websocketx.*
import io.netty.util.concurrent.{ Future as NettyFuture, GenericFutureListener }
import org.apache.pekko.actor.typed.{ ActorRef, Scheduler }

import java.util.concurrent.TimeUnit

import lila.ws.Controller.Endpoint
Expand Down Expand Up @@ -81,7 +82,7 @@ final private class ActorChannelConnector(

val nextIntervalMillis =
if !config.alwaysFlush() then config.interval.get()
else if flushQ.isEmpty then 1 // hibernate
else 1 // interval is 0 but we still need to empty the queue
else if flushQ.isEmpty then 1000 // hibernate
else 1 // interval is 0 but we still need to empty the queue

workers.schedule[Unit](() => flush(), nextIntervalMillis, TimeUnit.MILLISECONDS)

0 comments on commit 73bd3e4

Please sign in to comment.