<commit_before>package lila.lobby

import scala.concurrent.duration._
import scala.concurrent.Future

import akka.actor._
import akka.pattern.ask
import play.api.libs.iteratee._
import play.api.libs.json._
import play.twirl.api.Html

import actorApi._
import lila.common.PimpedJson._
import lila.game.actorApi._
import lila.game.AnonCookie
import lila.hub.actorApi.game.ChangeFeatured
import lila.hub.actorApi.lobby._
import lila.hub.actorApi.timeline._
import lila.socket.actorApi.{ Connected => _, _ }
import lila.socket.{ SocketActor, History, Historical }
import makeTimeout.short

private[lobby] final class Socket(
    val history: History[Messadata],
    router: akka.actor.ActorSelection,
    uidTtl: FiniteDuration) extends SocketActor[Member](uidTtl) with Historical[Member, Messadata] {

  override val startsOnApplicationBoot = true

  override def preStart {
    super.preStart
    context.system.lilaBus.subscribe(self, 'changeFeaturedGame, 'streams, 'nbMembers)
  }

  def receiveSpecific = {

    case PingVersion(uid, v) =>
      ping(uid)
      withMember(uid) { m =>
        history.since(v).fold(resync(m))(_ foreach sendMessage(m))
      }

    case Join(uid, user, blocks, mobile) =>
      val (enumerator, channel) = Concurrent.broadcast[JsValue]
      val member = Member(channel, user, blocks, uid, mobile)
      addMember(uid, member)
      sender ! Connected(enumerator, member)

    case ReloadTournaments(html) => notifyAllAsync(makeMessage("tournaments", html))

    case ReloadSimuls(html)      => notifyAllAsync(makeMessage("simuls", html))

    case NewForumPost            => notifyAllAsync("reload_forum")

    case ReloadTimeline(userId) =><commit_msg>make lobby ping asynchronous<commit_after>package lila.lobby

import scala.concurrent.duration._
import scala.concurrent.Future

import akka.actor._
import akka.pattern.ask
import play.api.libs.iteratee._
import play.api.libs.json._
import play.twirl.api.Html

import actorApi._
import lila.common.PimpedJson._
import lila.game.actorApi._
import lila.game.AnonCookie
import lila.hub.actorApi.game.ChangeFeatured
import lila.hub.actorApi.lobby._
import lila.hub.actorApi.timeline._
import lila.socket.actorApi.{ Connected => _, _ }
import lila.socket.{ SocketActor, History, Historical }
import makeTimeout.short

private[lobby] final class Socket(
    val history: History[Messadata],
    router: akka.actor.ActorSelection,
    uidTtl: FiniteDuration) extends SocketActor[Member](uidTtl) with Historical[Member, Messadata] {

  override val startsOnApplicationBoot = true

  override def preStart {
    super.preStart
    context.system.lilaBus.subscribe(self, 'changeFeaturedGame, 'streams, 'nbMembers)
  }

  def receiveSpecific = {

    case PingVersion(uid, v) => Future {
      ping(uid)
      withMember(uid) { m =>
        history.since(v).fold(resync(m))(_ foreach sendMessage(m))
      }
    }

    case Join(uid, user, blocks, mobile) =>
      val (enumerator, channel) = Concurrent.broadcast[JsValue]
      val member = Member(channel, user, blocks, uid, mobile)
      addMember(uid, member)
      sender ! Connected(enumerator, member)

    case ReloadTournaments(html) => notifyAllAsync(makeMessage("tournaments", html))

    case ReloadSimuls(html)      => notifyAllAsync(makeMessage("simuls", html))

    case NewForumPost            => notifyAllAsync("reload_forum")

    case ReloadTimeline(userId) =>
{'fraction_non_alphanumeric': 0.1080446271285966, 'fraction_numerical': 0.0, 'mean_word_length': 4.185692541856925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2958952', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1056, 'n_words': 230}