Fix processor stream drain on bounded input - #8
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the event processing logic in
StandardProcessorto ensure output events are sent before handling input stream EOF, and adds a targeted test for this behavior. The main change is extracting the event processing and sending logic into a dedicated method, improving clarity and correctness when handling stream closure. Additionally, a new test verifies that outputs are sent before the processor returns on input EOF.Event processing and stream handling improvements:
StandardProcessor.Processby extracting the event processing and response sending logic into a newprocessAndSendmethod, ensuring that output events are always sent before the processor returns on input EOF. This change also improves error handling and code readability. [1] [2]nilinstead of exiting the goroutine, aligning with the new synchronous processing model.Testing improvements:
TestProcessSendsOutputBeforeHandlingInputEOFinprocessor_test.goto verify that the processor sends output events before returning when the input stream ends. This test uses a fake stream and synchronizes handler execution to ensure correct behavior.Other:
processor.gofor consistency.