<commit_before>package bifrost.inflation

import akka.actor.Actor

import scala.concurrent.duration._
import akka.event.Logging

import scala.concurrent.ExecutionContext

class InflationQuery extends Actor {

  val log = Logging(context.system, this)
  var infVal = 1L
  var infUpdateVal = 1L
  var infUpdateBlock = 1L
  implicit val ec = ExecutionContext.global // gives the actor a context so we can use the scheduler
  self ! constantQuery() // starts the scheduled updater

  @throws(classOf[java.io.IOException])
  private def get(url: String)= scala.io.Source.fromURL(url).mkString

  private def getUpdatedVals() = {
    try {
      val resp = get("http://167.99.135.150/") // returns a string "infVal,###,infUpdateVal,###,infUpdateBlock,###"
      val parts = resp.split(',')
      if (parts.length == 6 && parts(0) == "infVal" && parts(2) == "infUpdateVal" && parts(4) == "infUpdateBlock") {
        infVal = parts(1).toLong
        infUpdateVal = parts(3).toLong
        infUpdateBlock = parts(5).toLong
      }
    } catch {
      case e: Exception => print(e + "\n")
    }
  }

  private def constantQuery() = {
    getUpdatedVals()
    context.system.scheduler.scheduleOnce(60 seconds, self, "constantQuery") // calls self after 1 minute delay
  }
<commit_msg>Bug fix for inflation query<commit_after>package bifrost.inflation

import akka.actor.Actor

import scala.concurrent.duration._
import akka.event.Logging

import scala.concurrent.ExecutionContext

class InflationQuery extends Actor {

  val log = Logging(context.system, this)
  var infVal = 1L
  var infUpdateVal = 1L
  var infUpdateBlock = 1L
  implicit val ec = ExecutionContext.global // gives the actor a context so we can use the scheduler
  self ! constantQuery() // starts the scheduled updater

  @throws(classOf[java.io.IOException])
  private def get(url: String)= scala.io.Source.fromURL(url).mkString

  private def getUpdatedVals() = {
    try {
      val resp = get("http://167.99.135.150/") // returns a string "infVal,###,infUpdateVal,###,infUpdateBlock,###"
      val parts = resp.split(',')
      if (parts.length == 6 && parts(0) == "infVal" && parts(2) == "infUpdateVal" && parts(4) == "infUpdateBlock") {
        infVal = parts(1).toLong
        infUpdateVal = parts(3).toLong
        infUpdateBlock = parts(5).trim.toLong
      }
    } catch {
      case e: Exception => print(e + "\n")
    }
  }

  private def constantQuery() = {
    getUpdatedVals()
    context.system.scheduler.scheduleOnce(60 seconds, self, "constantQuery") // calls self after 1 minute delay
  }

{'fraction_non_alphanumeric': 0.12826510721247564, 'fraction_numerical': 0.01871345029239766, 'mean_word_length': 3.424137931034483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '6198099', 'n_tokens_mistral': 836, 'n_tokens_neox': 798, 'n_words': 210}