Skip to content

Commit 0aea0fc

Browse files
committed
PR comments
1 parent 5c094fa commit 0aea0fc

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/spi/v1/MessageDispatcher.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ public String toString() {
114114
for (AckHandler ah : ackHandlers) {
115115
ackIds.add(ah.ackId);
116116
}
117-
return String.format("ExtensionJob {expiration: %s, nextExtensionSeconds: %d, ackIds: %s}", expiration, nextExtensionSeconds, ackIds);
117+
return String.format(
118+
"ExtensionJob {expiration: %s, nextExtensionSeconds: %d, ackIds: %s}",
119+
expiration, nextExtensionSeconds, ackIds);
118120
}
119121
}
120122

@@ -138,7 +140,9 @@ public void addAckId(String ackId) {
138140
}
139141

140142
public String toString() {
141-
return String.format("extend %d sec: %s", deadlineExtensionSeconds, ackIds);
143+
return String.format(
144+
"PendingModifyAckDeadline{extension: %d sec, ackIds: %s}",
145+
deadlineExtensionSeconds, ackIds);
142146
}
143147
}
144148

@@ -284,6 +288,11 @@ public void run() {
284288
});
285289
}
286290

291+
// There is a race condition. setupNextAckDeadlineExtensionAlarm might set
292+
// an alarm that fires before this block can run.
293+
// The fix is to move setup below this block, but doing so aggravates another
294+
// race condition.
295+
// TODO(pongad): Fix both races.
287296
synchronized (outstandingAckHandlers) {
288297
outstandingAckHandlers.add(
289298
new ExtensionJob(expiration, INITIAL_ACK_DEADLINE_EXTENSION_SECONDS, ackHandlers));

0 commit comments

Comments
 (0)