Skip to content

Releases: ElMassimo/request_store_rails

Using random store ids, and storing them in a different thread-local variable

20 May 13:21
Compare
Choose a tag to compare

After the concern brought up in #9, we no longer use the request id provided by ActionDispatch::RequestId, and instead always generate a random one.

This prevents two requests with the same externally provided id from sharing a store, which would usually happen by accident.

If for some reason your use case requires it, you can extend the middleware or monkeypatch the strategy.

Also, since we are no longer using the request id, changed the thread-local variable to request_store_id, which is more accurate (it identifies the store, not the request), and would allow applications to use Thread.current[:request_id] for the actual request id.