pjfanning opened a new pull request, #464:
URL: https://github.com/apache/pekko-projection/pull/464

   fixes #104 
   
   `atLeastOnceShouldRestartFromPreviousOffset` was intermittently failing with 
`expected:<abc|def|[ghi|]> but was:<abc|def|[]>` due to a race condition in 
`concatHandler`.
   
   `latch.countDown()` was called *before* `buffer.append()`, so when offset 3 
unblocked the test thread (latch → 0), `"ghi|"` hadn't been written to the 
buffer yet.
   
   **Fix:** reorder operations so `latch.countDown()` fires only after the 
buffer is updated:
   
   ```java
   // Before
   latch.countDown();
   if (failPredicate.test(envelope.offset)) {
       throw new RuntimeException(...);
   } else {
       buffer.append(envelope.message).append("|");
   }
   
   // After
   if (failPredicate.test(envelope.offset)) {
       latch.countDown();
       throw new RuntimeException(...);
   } else {
       buffer.append(envelope.message).append("|");
       latch.countDown();
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to