Class: Sbmt::Strangler::WorkModes::Replace

Inherits:
Base
  • Object
show all
Includes:
Dry::Monads::Result::Mixin
Defined in:
lib/sbmt/strangler/work_modes/replace.rb

Instance Attribute Summary

Attributes inherited from Base

#feature_flags, #metric_tracker, #rails_controller, #strangler_action

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Sbmt::Strangler::WorkModes::Base

Instance Method Details

#callObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/sbmt/strangler/work_modes/replace.rb', line 11

def call
  mirror_call_result = mirror_call
  track_mirror_call(mirror_call_result.success?)

  unless mirror_call_result.success?
    render(
      json: {error: "Mirror lambda call failed!"},
      status: :internal_server_error
    ) # TODO: Возможно стоит сделать фолбэк на проксирование?
    return
  end

  render_call_result = render_call(mirror_call_result.value!)
  track_render_call(render_call_result.success?)

  unless render_call_result.success?
    render(
      json: {error: "Render lambda call failed!"},
      status: :internal_server_error
    ) # TODO: Возможно стоит сделать фолбэк на проксирование?
    return
  end

  render render_call_result.value!
end