-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Description
In an environment using a Fiber pool (such as an evented Rack app), setting a Scrolls context in a Rack middleware will not then be available to all scopes within that request. This is because in Ruby 2.x Thread.current[]= behavior does not actually set a thread-local variable, but a Fiber-local one.
To achieve true thread locality you need to use thread_variable_get (and set). I believe this is how context should be implemented?
module Scrolls
module Log
def context=(h)
Thread.current.thread_variable_set(:scrolls_context, h || {})
end
def context
Thread.current.thread_variable_get(:scrolls_context)
end
end
endIf so, let me know and I can submit a proper PR. One up front question would be your preference in Ruby version detection.
Metadata
Metadata
Assignees
Labels
No labels