Skip to content

Commit

Permalink
Review feedback:improve changelog, use UTC time
Browse files Browse the repository at this point in the history
  • Loading branch information
anuchandy committed Jun 6, 2024
1 parent efcebac commit c32b921
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Features Added

- Added the support for batch-delete APIs in Receiver client.
- Added the support for batch delete APIs in `ServiceBusReceiverClient` and `ServiceBusReceiverAsyncClient`.

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -1545,7 +1546,7 @@ public Mono<Integer> purgeMessages(PurgeMessagesOptions options) {
.setBeforeEnqueueTimeUtc(options.getBeforeEnqueueTimeUtc());
} else {
deleteMessagesOptions = new DeleteMessagesOptions()
.setBeforeEnqueueTimeUtc(OffsetDateTime.now());
.setBeforeEnqueueTimeUtc(OffsetDateTime.now(ZoneOffset.UTC));
}
return deleteMessages(MAX_DELETE_MESSAGES_COUNT, deleteMessagesOptions, receiverOptions.getSessionId())
.expand(deleted -> {
Expand Down Expand Up @@ -1592,7 +1593,7 @@ private Mono<Integer> deleteMessages(int messageCount, DeleteMessagesOptions opt
if (options.getBeforeEnqueueTimeUtc() != null) {
beforeEnqueueTimeUtc = options.getBeforeEnqueueTimeUtc();
} else {
beforeEnqueueTimeUtc = OffsetDateTime.now();
beforeEnqueueTimeUtc = OffsetDateTime.now(ZoneOffset.UTC);
}
final Mono<Integer> deleteMessages = connectionProcessor
.flatMap(connection -> connection.getManagementNode(entityPath, entityType))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.nio.charset.Charset;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
Expand Down Expand Up @@ -1479,7 +1480,8 @@ void purgeMessages() {
.verifyComplete();

final PurgeMessagesOptions options = new PurgeMessagesOptions()
.setBeforeEnqueueTimeUtc(OffsetDateTime.now().plusSeconds(5)); // 5-sec buffer to account for any clock skew.
// 5-sec buffer to account for any clock skew.
.setBeforeEnqueueTimeUtc(OffsetDateTime.now(ZoneOffset.UTC).plusSeconds(5));

// since the service can delete upto 4000 messages in a single batch, the purge operation will make
// 3 batch delete API calls to delete the 8200 messages.
Expand Down

0 comments on commit c32b921

Please sign in to comment.