<commit_before>FrameHandler = () ->
  watchdog_last_update = + new Date()
  last_reload_time = + new Date()
  first_update_received = false

  setInterval ->
    timestamp = + new Date()
    if watchdog_last_update < timestamp - 10000
      if first_update_received
        if timestamp - last_reload_time < 10000
          console.debug "No need to try reloading yet"
          return
      else
        if timestamp - last_reload_time < 60000
          console.debug "No watchdog event received from frame. Do not reload yet."
          return
      console.warn "Watchdog timer expired"
      elem = jq("#content-frame")
      src = elem.attr("src").split("?")[0] + "?#{timestamp}"
      elem.attr "src", src
      last_reload_time = timestamp
  , 2500

  window.addEventListener "message", (e) ->
    first_update_received = true
    watchdog_last_update = e.data
  , false

  return @

jq =>
  @frame_handler = new FrameHandler()<commit_msg>Simplify frame watchdog<commit_after>FrameHandler = () ->
  watchdog_last_update = + new Date()

  setInterval ->
    timestamp = + new Date()
    if watchdog_last_update < timestamp - 60000
      console.warn "Watchdog timer expired"
      elem = jq("#content-frame")
      src = elem.attr("src").split("?")[0] + "?#{timestamp}"
      elem.attr "src", src
  , 10000

  window.addEventListener "message", (e) ->
    watchdog_last_update = e.data
  , false

  return @

jq =>
  @frame_handler = new FrameHandler()
{'fraction_non_alphanumeric': 0.11454046639231824, 'fraction_numerical': 0.021262002743484224, 'mean_word_length': 2.8394736842105264, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '7237852', 'n_tokens_mistral': 474, 'n_tokens_neox': 432, 'n_words': 113}