Skip to content

Commit

Permalink
Merge pull request #65 from avast/FixTimerPairCE2
Browse files Browse the repository at this point in the history
TimerPairImpl fix
  • Loading branch information
jendakol authored May 27, 2022
2 parents 6247207 + c4a2b06 commit e0a7122
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import cats.effect.Sync
import cats.syntax.applicativeError._
import cats.syntax.flatMap._
import cats.syntax.functor._

import java.time.{Duration => JDuration}
import com.avast.metrics.scalaeffectapi.{Timer, TimerPair}

import java.time.{Duration => JDuration}
import scala.concurrent.duration.Duration

private class TimerPairImpl[F[_]: Sync](success: Timer[F], failure: Timer[F]) extends TimerPair[F] {
Expand All @@ -27,13 +26,13 @@ private class TimerPairImpl[F[_]: Sync](success: Timer[F], failure: Timer[F]) ex
}
}

override def update(duration: JDuration): F[Unit] = Sync[F].delay(success.update(duration))
override def update(duration: JDuration): F[Unit] = success.update(duration)

override def updateFailure(duration: JDuration): F[Unit] = Sync[F].delay(failure.update(duration))
override def updateFailure(duration: JDuration): F[Unit] = failure.update(duration)

override def update(duration: Duration): F[Unit] = Sync[F].delay(success.update(duration))
override def update(duration: Duration): F[Unit] = success.update(duration)

override def updateFailure(duration: Duration): F[Unit] = Sync[F].delay(failure.update(duration))
override def updateFailure(duration: Duration): F[Unit] = failure.update(duration)

override def time[T](action: F[T]): F[T] = {
for {
Expand Down

0 comments on commit e0a7122

Please sign in to comment.