Module: Axn::Async::CurrentRetryContext

Defined in:
lib/axn/async/retry_context.rb

Overview

Thread-local storage for the current async retry context

Class Method Summary collapse

Class Method Details

.clearObject



89
90
91
# File 'lib/axn/async/retry_context.rb', line 89

def clear
  self.current = nil
end

.currentObject



73
74
75
# File 'lib/axn/async/retry_context.rb', line 73

def current
  ActiveSupport::IsolatedExecutionState[:_axn_async_retry_context]
end

.current=(context) ⇒ Object



77
78
79
# File 'lib/axn/async/retry_context.rb', line 77

def current=(context)
  ActiveSupport::IsolatedExecutionState[:_axn_async_retry_context] = context
end

.with(context) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/axn/async/retry_context.rb', line 81

def with(context)
  previous = current
  self.current = context
  yield
ensure
  self.current = previous
end