mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 11:38:07 +01:00
Use Durations everywhere, drop unused constructors, and add tests.
This commit is contained in:
committed by
Jon Chambers
parent
1faedd3870
commit
af2a8548c3
@@ -10,19 +10,14 @@ public class RateLimitExceededException extends Exception {
|
||||
|
||||
private final Duration retryDuration;
|
||||
|
||||
public RateLimitExceededException() {
|
||||
public RateLimitExceededException(final Duration retryDuration) {
|
||||
super();
|
||||
retryDuration = Duration.ZERO;
|
||||
this.retryDuration = retryDuration;
|
||||
}
|
||||
|
||||
public RateLimitExceededException(String message) {
|
||||
public RateLimitExceededException(final String message, final Duration retryDuration) {
|
||||
super(message);
|
||||
retryDuration = Duration.ZERO;
|
||||
}
|
||||
|
||||
public RateLimitExceededException(String message, long retryAfterMillis) {
|
||||
super(message);
|
||||
retryDuration = Duration.ofMillis(retryAfterMillis);
|
||||
this.retryDuration = retryDuration;
|
||||
}
|
||||
|
||||
public Duration getRetryDuration() { return retryDuration; }
|
||||
|
||||
@@ -10,14 +10,8 @@ import java.time.Duration;
|
||||
public class RetryLaterException extends Exception {
|
||||
private final Duration backoffDuration;
|
||||
|
||||
public RetryLaterException() {
|
||||
backoffDuration = Duration.ZERO;
|
||||
}
|
||||
public RetryLaterException(int retryLaterMillis) {
|
||||
backoffDuration = Duration.ofMillis(retryLaterMillis);
|
||||
}
|
||||
|
||||
public RetryLaterException(RateLimitExceededException e) {
|
||||
super(e);
|
||||
this.backoffDuration = e.getRetryDuration();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user