From c1c013163da67600862636b245db92f4ef8b35ba Mon Sep 17 00:00:00 2001 From: Frank Rosner Date: Tue, 21 Nov 2017 18:07:00 +0100 Subject: [PATCH] #334 log total number of channels --- .../de/frosner/broccoli/services/WebSocketService.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/src/main/scala/de/frosner/broccoli/services/WebSocketService.scala b/server/src/main/scala/de/frosner/broccoli/services/WebSocketService.scala index b99391a31..d7adefff7 100644 --- a/server/src/main/scala/de/frosner/broccoli/services/WebSocketService.scala +++ b/server/src/main/scala/de/frosner/broccoli/services/WebSocketService.scala @@ -26,8 +26,11 @@ class WebSocketService @Inject()(templateService: TemplateService, private val scheduler = new ScheduledThreadPoolExecutor(1) private val task = new Runnable { - def run() = - logging.logExecutionTime(s"Updating ${connections.size} websocket clients") { + def run() = { + val numChannels = connections.foldLeft(0) { + case (n, (id, (account, channels))) => n + channels.size + } + logging.logExecutionTime(s"Updating $numChannels websocket channels for ${connections.size} sessions") { broadcast { user => Json.toJson(OutgoingMessage.AboutInfoMsg(AboutController.about(aboutInfoService, user))) } @@ -38,6 +41,7 @@ class WebSocketService @Inject()(templateService: TemplateService, Json.toJson(OutgoingMessage.ListInstances(InstanceController.list(None, user, instanceService))) } }(log.info(_)) + } } private val scheduledTask = scheduler.scheduleWithFixedDelay(task, 0, 1, TimeUnit.SECONDS)