Class: Actions::Middleware::KeepCurrentRequestID

Inherits:
Dynflow::Middleware
  • Object
show all
Defined in:
app/lib/actions/middleware/keep_current_request_id.rb

Instance Method Summary collapse

Instance Method Details

#delay(*args) ⇒ Object



4
5
6
# File 'app/lib/actions/middleware/keep_current_request_id.rb', line 4

def delay(*args)
  pass(*args).tap { store_current_request_id }
end

#finalizeObject



18
19
20
# File 'app/lib/actions/middleware/keep_current_request_id.rb', line 18

def finalize
  restore_current_request_id { pass }
end

#hook(*args) ⇒ Object

Run all execution plan lifecycle hooks as the original request_id



23
24
25
26
27
28
# File 'app/lib/actions/middleware/keep_current_request_id.rb', line 23

def hook(*args)
  store_current_request_id if !action.input.key?(:current_request_id) && ::Logging.mdc['request']
  restore_current_request_id do
    pass(*args)
  end
end

#plan(*args) ⇒ Object



8
9
10
11
12
# File 'app/lib/actions/middleware/keep_current_request_id.rb', line 8

def plan(*args)
  with_current_request_id do
    pass(*args).tap { store_current_request_id }
  end
end

#run(*args) ⇒ Object



14
15
16
# File 'app/lib/actions/middleware/keep_current_request_id.rb', line 14

def run(*args)
  restore_current_request_id { pass(*args) }
end