Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💥 Changes to responses handling, motivated by thread-safety #93

Merged
merged 2 commits into from
Jan 7, 2023

Commits on Jan 6, 2023

  1. 🗑️ Deprecate client_thread with a warning

    There is no one single client_thread, this isn't used internally, and
    it's misleading to external users.  However, adding `#reciever_thread`
    (or `#receiver_fiber`) might be useful.
    nevans committed Jan 6, 2023
    Configuration menu
    Copy the full SHA
    4fe002b View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2023

  1. 💥 Update responses methods for thread-safety

    Calling `#responses` with no block is deprecated, as it can't be made
    thread-safe and backward-compatible.  However, the deprecation warning
    is commented out for now, until after I can check the test suites for
    the rails and mail gems and submit PRs there if necessary.
    
    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.
    nevans committed Jan 7, 2023
    Configuration menu
    Copy the full SHA
    800edb8 View commit details
    Browse the repository at this point in the history