Skip to content

Commit

Permalink
use Monix scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
alextheimer committed Dec 6, 2021
1 parent 2c73554 commit 8f3140f
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package filodb.coordinator

import java.util.concurrent.TimeUnit

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.FiniteDuration
import scala.util.{Failure, Success}

import akka.actor.{ActorRef, ActorSystem}
import akka.actor.ActorRef
import com.typesafe.scalalogging.StrictLogging
import kamon.Kamon
import kamon.tag.TagSet
import monix.execution.Scheduler.Implicits.{global => scheduler}

import filodb.coordinator.client.Client
import filodb.coordinator.client.QueryCommands.LogicalPlan2Query
Expand Down Expand Up @@ -43,9 +43,13 @@ case class TenantIngestionMetering(settings: FilodbSettings,
private val METRIC_TOTAL = "total_timeseries_by_tenant"

def schedulePeriodicPublishJob() : Unit = {
ActorSystem().scheduler.schedule(
SCHED_INIT_DELAY,
SCHED_DELAY,
// NOTE: the FiniteDuration overload of scheduleWithFixedDelay
// does not work. Unsure why, but that's why these FiniteDurations are
// awkwardly parsed into seconds.
scheduler.scheduleWithFixedDelay(
SCHED_INIT_DELAY.toSeconds,
SCHED_DELAY.toSeconds,
TimeUnit.SECONDS,
() => queryAndSchedulePublish())
}

Expand Down

0 comments on commit 8f3140f

Please sign in to comment.