From 24adaa7bd0c006e9ba93e8aa198418a55adbac51 Mon Sep 17 00:00:00 2001 From: Jonathan Gamble Date: Tue, 24 Sep 2024 08:50:19 -0500 Subject: [PATCH] keep endpoint urls out of lower level code --- src/main/scala/Controller.scala | 10 ++++++---- src/main/scala/netty/ActorChannelConnector.scala | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/scala/Controller.scala b/src/main/scala/Controller.scala index e456737d..7f767a4e 100644 --- a/src/main/scala/Controller.scala +++ b/src/main/scala/Controller.scala @@ -155,7 +155,8 @@ final class Controller( ) { Deps(emit, req, services) }, header, credits = 100, - interval = 20.seconds + interval = 20.seconds, + alwaysFlush = true ) case _ => notFound @@ -302,14 +303,15 @@ object Controller: val rateLimit: RateLimit, val header: RequestHeader, val emitCounter: kamon.metric.Counter, - val name: String + val alwaysFlush: Boolean ) def endpoint( name: String, behavior: ClientEmit => ClientBehavior, header: RequestHeader, credits: Int, - interval: FiniteDuration + interval: FiniteDuration, + alwaysFlush: Boolean = false ): ResponseSync = Monitor.connection.open(name) Right: @@ -322,7 +324,7 @@ object Controller: ), header, Monitor.clientInCounter(name), - name + alwaysFlush ) type ResponseSync = Either[HttpResponseStatus, Endpoint] diff --git a/src/main/scala/netty/ActorChannelConnector.scala b/src/main/scala/netty/ActorChannelConnector.scala index bb9a1b43..3901049a 100644 --- a/src/main/scala/netty/ActorChannelConnector.scala +++ b/src/main/scala/netty/ActorChannelConnector.scala @@ -18,7 +18,7 @@ final private class ActorChannelConnector(clients: ActorRef[Clients.Control], lo val clientPromise = Promise[Client]() channel.attr(key.client).set(clientPromise.future) val channelEmit: ClientEmit = - emitToChannel(channel, withFlush = endpoint.name == "round/play") + emitToChannel(channel, withFlush = endpoint.alwaysFlush) val monitoredEmit: ClientEmit = (msg: ipc.ClientIn) => endpoint.emitCounter.increment() channelEmit(msg)