<commit_before>package io.vamp.common.akka

import akka.actor._
import io.vamp.common.akka.SchedulerActor.Period

import scala.concurrent.duration._
import scala.language.postfixOps

object SchedulerActor {

  case class Period(period: FiniteDuration)

}

abstract class SchedulerActor extends CommonSupportForActors {

  private var timer: Option[Cancellable] = None

  def receive: Receive = {
    case Period(period) => schedule(period)
  }

  def schedule(period: FiniteDuration) = {
    timer.map(_.cancel())
    if (period.toNanos > 0) {
      timer = Some(context.system.scheduler.schedule(0 seconds, period, new Runnable {
        def run() = {
          tick()
        }
      }))
    } else timer = None
  }
<commit_msg>bug fix: shceduler actor with tick message and not with direct method call<commit_after>package io.vamp.common.akka

import akka.actor._
import io.vamp.common.akka.SchedulerActor.{Period, Tick}

import scala.concurrent.duration._
import scala.language.postfixOps

object SchedulerActor {

  case class Period(period: FiniteDuration)

  object Tick

}

abstract class SchedulerActor extends CommonSupportForActors {

  private var timer: Option[Cancellable] = None

  def receive: Receive = {
    case Tick => tick()
    case Period(period) => schedule(period)
  }

  def schedule(period: FiniteDuration) = {
    timer.map(_.cancel())
    timer = if (period.toNanos > 0) Some(context.system.scheduler.schedule(0 seconds, period, self, Tick)) else None
  }

{'fraction_non_alphanumeric': 0.10033670033670034, 'fraction_numerical': 0.0026936026936026937, 'mean_word_length': 3.809061488673139, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '2888096', 'n_tokens_mistral': 471, 'n_tokens_neox': 457, 'n_words': 116}