<commit_before>package lila.fishnet

import scala.concurrent.duration._

import lila.hub.actorApi.slack.{ Victory, Warning }
import lila.memo.ExpireSetMemo

private final class MainWatcher(
    repo: FishnetRepo,
    bus: lila.common.Bus,
    scheduler: lila.common.Scheduler) {

  private val alerted = new ExpireSetMemo(1 hour)

  private def isAlerted(client: Client) = alerted get client.key.value

  private def alert(client: Client) = if (!isAlerted(client)) {
    alerted put client.key.value
    bus.publish(Warning(s"Fishnet server ${client.userId} might be down!"), 'slack)
  }

  private def unalert(client: Client) = if (isAlerted(client)) {
    alerted remove client.key.value
    bus.publish(Victory(s"Fishnet server ${client.userId} is back!"), 'slack)
  }<commit_msg>alert slack of down fishnet nodes less often<commit_after>package lila.fishnet

import scala.concurrent.duration._

import lila.hub.actorApi.slack.{ Victory, Warning }
import lila.memo.ExpireSetMemo

private final class MainWatcher(
    repo: FishnetRepo,
    bus: lila.common.Bus,
    scheduler: lila.common.Scheduler) {

  private val alerted = new ExpireSetMemo(6 hour)

  private def isAlerted(client: Client) = alerted get client.key.value

  private def alert(client: Client) = if (!isAlerted(client)) {
    alerted put client.key.value
    bus.publish(Warning(s"Fishnet server ${client.userId} might be down!"), 'slack)
  }

  private def unalert(client: Client) = if (isAlerted(client)) {
    alerted remove client.key.value
    bus.publish(Victory(s"Fishnet server ${client.userId} is back!"), 'slack)
  }
{'fraction_non_alphanumeric': 0.11271133375078271, 'fraction_numerical': 0.0012523481527864746, 'mean_word_length': 4.398648648648648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2638843', 'n_tokens_mistral': 542, 'n_tokens_neox': 525, 'n_words': 135}