-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💥 Update responses methods for thread-safety
Calling `#responses` with no block is deprecated, as it can't be made thread-safe and backward-compatible. For convenience, an optional `type` paramater has been added to `#responses`, to yield only the array for that type of response. Added `#clear_responses` as a convenience method for the common "read and delete" pattern, and to provide a thread-safe responses method that doesn't require a block. The response handlers methods are now synchronized, but `#response_handlers` now returns a frozen clone to alert users who had manipulated it directly. Hopefully very few are affected, but this change is backwards incompatible. N.b: there currently is no API for inserting a response_handler into a particular position in the array. Also, improve the yields_in_test_server_thread test helper: it no longer reads `last_tag` from the block result, it sets a short `IO#timeout` in ruby 3.2+, it uses a slightly longer timeout for overall test completion, and it defines `sock.getcmd` so the tests can read more intuitively than using a proc passed into the block.
- Loading branch information
Showing
2 changed files
with
226 additions
and
50 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