Closed professor closed 7 months ago
This revert would work for me & my team, thank you. 👍
My only thought would be to add a regression test, something like the one in #97. I can confirm that (on Ruby 3.2+) this fails for me on 1.6 and passes with the changes in this PR:
def test_concurrent_stores
Thread.new { RequestStore.store[:foo] = 'bar' }.join
value = Thread.new { RequestStore.store[:foo] }.value
assert value != 'bar', 'Thread 2 should not see the value set by Thread 1'
end
Thanks. I'm hoping to add a regression test as a separate PR.
Thank you so much, both of you. <3
Fixes https://github.com/steveklabnik/request_store/issues/96 and Fixes #98
Unless a Fiber is initialized with
Fiber.new(storage: nil)
then there is cross Fiber pollution of the RequestStore if the RequestStore is initialized or used in any parent Fiber.Notes
1.6.0 added a method
RequestStore.scope
-- I was tempted to keep the method in 1.7.0 but decided to remove it for two reasons even though it is a breaking change.RequestStore.scope