Wait for the queue to complete before completing the request.#955
Merged
Wait for the queue to complete before completing the request.#955
Conversation
Ensures that the request queue is fully consumed before disconnecting a HTTP connection.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that ASP.NET Core requests do not complete prematurely by waiting for the Hub method queue to be fully consumed before completing the request.
- Changes in test files update log collections from List to ConcurrentBag for thread safety.
- A new test verifies proper queue consumption and disconnection behavior in StreamingHub.
- The StreamingHub implementation is updated to await the consumption of the request queue before invoking the disconnection logic.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/MagicOnion.Server.Tests/UnaryServiceTest.cs | Changes logs collection type to ConcurrentBag for thread safety. |
| tests/MagicOnion.Server.Tests/StreamingHubDisconnectionTest.cs | New test added to assess consumer behavior during disconnection. |
| tests/MagicOnion.Server.InternalTesting/MagicOnionApplicationFactory.cs | Updates logs property type to ConcurrentBag for consistency. |
| src/MagicOnion.Server/Hubs/StreamingHub.cs | Introduces waiting for the request queue consumption before completing a disconnection. |
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 PR fixes an issue where ASP.NET Core requests would complete first when a client disconnected while there were Hub method queues consuming or waiting.