Skip to content

Commit

Permalink
Added default poll interval constant
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge-beauregard committed Oct 27, 2020
1 parent b4eddb1 commit 28e38f9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
public final class PhoneNumberAsyncClient {
private final ClientLogger logger = new ClientLogger(PhoneNumberAsyncClient.class);
private final PhoneNumberAdministrationsImpl phoneNumberAdministrations;
private final Duration DEFAULT_POLL_INTERVAL = Duration.ofSeconds(1);

PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) {
this.phoneNumberAdministrations = phoneNumberAdminClient.getPhoneNumberAdministrations();
Expand Down Expand Up @@ -779,7 +780,11 @@ Mono<Response<Void>> purchaseSearchWithResponse(String searchId, Context context
public PollerFlux<PhoneNumberSearch, PhoneNumberSearch> beginCreateSearch(
CreateSearchOptions options, Duration pollInterval) {
Objects.requireNonNull(options, "'options' cannot be null.");
Objects.requireNonNull(pollInterval, "'pollInterval' cannot be null.");

if (pollInterval == null) {
pollInterval = DEFAULT_POLL_INTERVAL;
}

return new PollerFlux<PhoneNumberSearch, PhoneNumberSearch>(pollInterval,
createSearchActivationOperation(options),
createSearchPollOperation(),
Expand Down Expand Up @@ -851,7 +856,7 @@ public PollerFlux<Void, Void> beginPurchaseSearch(String searchId, Duration poll
Objects.requireNonNull(searchId, "'searchId' can not be null.");

if (pollInterval == null) {
pollInterval = Duration.ofSeconds(5);
pollInterval = DEFAULT_POLL_INTERVAL;
}

return new PollerFlux<Void, Void>(pollInterval,
Expand Down

0 comments on commit 28e38f9

Please sign in to comment.