Repository navigation
Fix Pub/Sub nack - #5192
Fix Pub/Sub nack#5192ievdokdm wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors request and subscription handling to improve reliability and concurrency control. Key changes include introducing distinct in-progress and processed cache locks to handle concurrent Pub/Sub redeliveries with 503 NACKs, ensuring HTTP clients are closed in PubSub, and refactoring RequestHandler to separate dispatching from responding. Feedback on these changes suggests removing a redundant HttpStatusException catch block, reusing the inherited respond helper method to avoid manual response writing, and wrapping cache operations (purge and update) in try-catch blocks to prevent suppressing original exceptions or blocking successful responses due to transient cache failures.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the request and subscription handling logic to improve reliability and concurrency management. Specifically, it introduces distinct 'processing' and 'processed' lock states in SubscriptionHandler to return a 503 NACK when a message is already being processed concurrently, and updates or purges locks before responding to prevent race conditions on retries. Additionally, it refactors RequestHandler to separate dispatching from responding, ensures httpClient is closed in PubSub, and adds comprehensive tests for these scenarios. I have no further feedback to provide as the changes are well-implemented and covered by tests.
Fixes Pub/Sub push retry drops in
SubscriptionHandlerwhen forwarding toordered-presubmit(or any handler) fails with 5XX:p) vs processed (l) cache locks and return503(NACK) instead of200(ACK) on concurrent redeliveries while a message is still in flight.httpClientinPubSub.publish.fix: flutter/flutter#196333