Skip to content

Commit

Permalink
Fixes lint error.
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenchickenlove committed Nov 17, 2024
1 parent aa24b47 commit 2c32f76
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1469,13 +1469,10 @@ protected void handleAsyncFailure() {

// If we use failedRecords.clear() to remove copied record from failed records,
// We may encounter race condition during this operation.
// Main Thread : copy 100 records from failed records.
// Thread A : Oops! I have an exception. Add record to failedRecords. (failedRecords size is 101)
// Main Thread : clear failedRecords!
// In this case, Main Thread misses one failed record.
int shouldRemoveCount = copyFailedRecords.size();
for (int i = 0; i < shouldRemoveCount; i++) {
failedRecords.pollFirst();
// Other, the thread which execute this block, may miss one failed record.
int capturedRecordsCount = copyFailedRecords.size();
for (int i = 0; i < capturedRecordsCount; i++) {
this.failedRecords.pollFirst();
}

// If any copied and failed record fails to complete due to an unexpected error,
Expand Down

0 comments on commit 2c32f76

Please sign in to comment.