Skip to content

Commit

Permalink
[fix] make sure the pendingAddOps.remove() and pendingAddOps.peek() p…
Browse files Browse the repository at this point in the history
…rocess the same element
  • Loading branch information
graysonzeng committed Jan 11, 2024
1 parent 4a4d1b2 commit d8c1f1a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1836,7 +1836,11 @@ void sendAddSuccessCallbacks() {
return;
}

pendingAddOps.remove();
if (!pendingAddOps.remove(pendingAddOp)) {
// If the remove operation fails, it means the element has already been removed by another thread.
// We should continue to the next iteration to process the next element.
continue;
}
explicitLacFlushPolicy.updatePiggyBackedLac(lastAddConfirmed);
pendingAddsSequenceHead = pendingAddOp.entryId;
if (!writeFlags.contains(WriteFlag.DEFERRED_SYNC)) {
Expand Down

0 comments on commit d8c1f1a

Please sign in to comment.