forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Websocket: Fix race on DataHandler during shutdown
Previously we would encounter situations where shutdown would race and fail TestConnectionMessageErrors, demonstrating that consumers might not be told why their connection is closing. * Do not drain DataHandler on dataMonitor shutdown Consumers should be allowed to process whatever messages were in flight prior to a socket shutdown * Ensure all DataHandler messages are sent to ToRoutine before shutdown This avoids a race where we'd read a message from DataHandler, but then process a shutdown before trying to relay it. The relay is non-blocking anyway, so we can trust that we'd pick up the Shutdown during the next loop. * Send errors to DataHandler before starting a shutdown This just reduces the chance of a race on shutdown processing
- Loading branch information
Showing
2 changed files
with
12 additions
and
24 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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