Skip to content

Commit

Permalink
#334 log total number of channels
Browse files Browse the repository at this point in the history
  • Loading branch information
FRosner committed Nov 21, 2017
1 parent bf1462c commit c1c0131
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand All @@ -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)

Expand Down

0 comments on commit c1c0131

Please sign in to comment.