Skip to content

Commit

Permalink
Merge pull request #253 from peterneyens/use-realtime
Browse files Browse the repository at this point in the history
Use Clock#realTime for Open#startedAt
  • Loading branch information
ChristopherDavenport authored Apr 12, 2023
2 parents f19f896 + 10fcb29 commit 4f8f629
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ object CircuitBreaker {
case Open(_,_) => (ClosedZero, onClosed.attempt.void)
}.flatten
case Outcome.Errored(_) =>
Temporal[F].monotonic.map(_.toMillis).flatMap { now =>
Temporal[F].realTime.map(_.toMillis).flatMap { now =>

ref.modify {
case Closed(failures) =>
Expand All @@ -621,7 +621,7 @@ object CircuitBreaker {
}

def tryReset[A](open: Open, fa: F[A], poll: Poll[F]): F[A] = {
Temporal[F].monotonic.map(_.toMillis).flatMap { now =>
Temporal[F].realTime.map(_.toMillis).flatMap { now =>
if (open.expiresAt >= now) onRejected >> F.raiseError(RejectedExecution(open))
else {
// This operation must succeed at setting backing to some other
Expand Down

0 comments on commit 4f8f629

Please sign in to comment.