diff options
author | Håkon Hallingstad <hakon@oath.com> | 2018-11-01 23:57:14 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@oath.com> | 2018-11-01 23:57:14 +0100 |
commit | ddd668831dd89d6a6d5cc89203c6acbf1d00032c (patch) | |
tree | 7263e95ec856d05da04a6ac7fd9622d10c451ac3 /vespajlib | |
parent | 23f8367787ac42870bd49b2d633f7c8b872c2695 (diff) |
Wrap CC HTTP failures in 409
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/time/TimeBudget.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/time/TimeBudget.java b/vespajlib/src/main/java/com/yahoo/time/TimeBudget.java index 449b0d6bd05..b3750440493 100644 --- a/vespajlib/src/main/java/com/yahoo/time/TimeBudget.java +++ b/vespajlib/src/main/java/com/yahoo/time/TimeBudget.java @@ -78,6 +78,11 @@ public class TimeBudget { return new TimeBudget(clock, now, deadline.map(d -> Duration.between(now, d))); } + /** Returns a new TimeBudget with the same clock and start, but with this deadline. */ + public TimeBudget withDeadline(Instant deadline) { + return new TimeBudget(clock, start, Optional.of(Duration.between(start, deadline))); + } + private static Duration nonNegativeBetween(Instant start, Instant end) { return makeNonNegative(Duration.between(start, end)); } |