Skip to content

Commit 005341f

Browse files
committed
addressed code quality feedback
1 parent fa527ef commit 005341f

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

exporthistory/src/main/java/com/microsoft/durabletask/exporthistory/ExportJobOrchestrator.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ private BatchExportResult processBatchWithRetry(
151151
TaskOrchestrationContext ctx,
152152
List<String> instanceIds,
153153
ExportJobConfiguration config) {
154-
for (int attempt = 1; attempt <= MAX_RETRY_ATTEMPTS; attempt++) {
154+
// Retries until the batch fully succeeds or MAX_RETRY_ATTEMPTS is reached; every path returns from inside.
155+
for (int attempt = 1; ; attempt++) {
155156
List<ExportResult> results = exportBatch(ctx, instanceIds, config);
156157
List<ExportResult> failedResults = results.stream()
157158
.filter(r -> !r.isSuccess())
@@ -161,7 +162,7 @@ private BatchExportResult processBatchWithRetry(
161162
return BatchExportResult.succeeded(results.size());
162163
}
163164

164-
if (attempt == MAX_RETRY_ATTEMPTS) {
165+
if (attempt >= MAX_RETRY_ATTEMPTS) {
165166
Instant now = ctx.getCurrentInstant();
166167
int finalAttempt = attempt;
167168
List<ExportFailure> failures = failedResults.stream()
@@ -179,9 +180,6 @@ private BatchExportResult processBatchWithRetry(
179180
MIN_BACKOFF_SECONDS * (int) Math.pow(2, attempt - 1), MAX_BACKOFF_SECONDS);
180181
ctx.createTimer(Duration.ofSeconds(backoffSeconds)).await();
181182
}
182-
183-
// Unreachable: the loop either returns success/failure or retries.
184-
return BatchExportResult.succeeded(0);
185183
}
186184

187185
private List<ExportResult> exportBatch(

exporthistory/src/test/java/com/microsoft/durabletask/exporthistory/ExportHistoryIntegrationTest.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.azure.storage.blob.BlobContainerClient;
77
import com.azure.storage.blob.BlobServiceClient;
88
import com.azure.storage.blob.BlobServiceClientBuilder;
9-
import com.azure.storage.blob.models.BlobItem;
109
import com.azure.storage.blob.models.BlobProperties;
1110
import com.microsoft.durabletask.DurableTaskClient;
1211
import com.microsoft.durabletask.DurableTaskGrpcClientBuilder;
@@ -213,11 +212,7 @@ private static long countBlobs(String container) {
213212
if (!containerClient.exists()) {
214213
return 0;
215214
}
216-
long count = 0;
217-
for (BlobItem ignored : containerClient.listBlobs()) {
218-
count++;
219-
}
220-
return count;
215+
return containerClient.listBlobs().stream().count();
221216
}
222217

223218
private DurableTaskGrpcWorkerBuilder createWorkerBuilder() {

0 commit comments

Comments
 (0)