Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public List<Lease> selectLeasesToTake(List<Lease> allLeases) {
Lease stolenLease = getLeaseToSteal(workerToPartitionCount, target, partitionsNeededForMe, allPartitions);
List<Lease> stolenLeases = new ArrayList<>();

if (stolenLease == null) {
if (stolenLease != null) {
stolenLeases.add(stolenLease);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.time.ZonedDateTime;

import static com.azure.data.cosmos.CommonsBridgeInternal.partitionKeyRangeIdInternal;
import static java.time.temporal.ChronoUnit.MILLIS;

/**
* Implementation for {@link PartitionProcessor}.
Expand Down Expand Up @@ -143,6 +144,19 @@ public Mono<Void> run(CancellationToken cancellationToken) {
this.logger.warn("Reducing getMaxItemCount, new getValue: {}", this.options.getMaxItemCount());
return Flux.empty();
}
case TRANSIENT_ERROR: {
// Retry on transient (429) errors
if (clientException.getRetryAfterInMilliseconds() > 0) {
ZonedDateTime stopTimer = ZonedDateTime.now().plus(clientException.getRetryAfterInMilliseconds(), MILLIS);
return Mono.just(clientException.getRetryAfterInMilliseconds()) // set some seed value to be able to run
// the repeat loop
.delayElement(Duration.ofMillis(100))
.repeat( () -> {
ZonedDateTime currentTime = ZonedDateTime.now();
return !cancellationToken.isCancellationRequested() && currentTime.isBefore(stopTimer);
}).flatMap( values -> Flux.empty());
}
}
default: {
this.logger.error("Unrecognized DocDbError enum getValue {}", docDbError, clientException);
this.resultException = new RuntimeException(clientException);
Expand Down