diff --git a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/ServiceWithActorSystem.scala b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/ServiceWithActorSystem.scala index 211ffa4ff3..2a592db658 100644 --- a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/ServiceWithActorSystem.scala +++ b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/ServiceWithActorSystem.scala @@ -39,19 +39,43 @@ trait ServiceWithActorSystem extends Service { import scala.jdk.CollectionConverters._ val loggers: java.lang.Iterable[String] = Seq("akka.event.Logging$StandardOutLogger").asJava - val config = ConfigFactory - .empty() - .withValue("akka.loggers", ConfigValueFactory.fromAnyRef(loggers)) - .withValue( - "akka.logging-filter", - ConfigValueFactory.fromAnyRef("akka.event.DefaultLoggingFilter") + val config = { + val baseConfig = ConfigFactory + .empty() + .withValue("akka.loggers", ConfigValueFactory.fromAnyRef(loggers)) + .withValue( + "akka.logging-filter", + ConfigValueFactory.fromAnyRef("akka.event.DefaultLoggingFilter") + ) + .withValue("akka.loglevel", ConfigValueFactory.fromAnyRef("WARNING")) + .withValue( + "akka.coordinated-shutdown.run-by-actor-system-terminate", + ConfigValueFactory.fromAnyRef("off") + ) + .withValue("akka.daemonic", ConfigValueFactory.fromAnyRef("on")) + .withValue( + "akka.http.server.websocket.periodic-keep-alive-mode", + ConfigValueFactory.fromAnyRef("ping") + ) + .withValue( + "akka.http.server.websocket.periodic-keep-alive-max-idle", + ConfigValueFactory.fromAnyRef("30 seconds") + ) + + val timeouts = Seq( + "akka.http.server.idle-timeout", + "akka.http.client.idle-timeout", + "akka.http.host-connection-pool.client.idle-timeout", + "akka.http.host-connection-pool.idle-timeout" ) - .withValue("akka.loglevel", ConfigValueFactory.fromAnyRef("WARNING")) - .withValue( - "akka.coordinated-shutdown.run-by-actor-system-terminate", - ConfigValueFactory.fromAnyRef("off") - ) - .withValue("akka.daemonic", ConfigValueFactory.fromAnyRef("on")) + val configWithTimeouts = timeouts.foldLeft(baseConfig) { + case (config, key) => + config.withValue(key, ConfigValueFactory.fromAnyRef("120 seconds")) + } + + configWithTimeouts + } + ActorSystem( name, config, diff --git a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/printers/FileOutputPrinter.scala b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/printers/FileOutputPrinter.scala index 3fed13fcd1..de9a498074 100644 --- a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/printers/FileOutputPrinter.scala +++ b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/printers/FileOutputPrinter.scala @@ -29,6 +29,10 @@ class FileOutputPrinter( override def print(message: WSLogMessage): Unit = { val lines = renderer.render(message) writer.println(lines) + // TODO [RW] we may consider making flushing configurable as it is mostly + // useful for debugging crashes, whereas for usual usecases buffering could + // give slightly better performance + writer.flush() } /** @inheritdoc */