Class: Textus::Application::Refresh::Orchestrator

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/refresh/orchestrator.rb

Instance Method Summary collapse

Constructor Details

#initialize(worker:, store_root:, bus: nil, store: nil, ctx: nil, hook_context: nil, detached_spawner: nil) ⇒ Orchestrator

rubocop:disable Metrics/ParameterLists



5
6
7
8
9
10
11
12
13
# File 'lib/textus/application/refresh/orchestrator.rb', line 5

def initialize(worker:, store_root:, bus: nil, store: nil, ctx: nil, hook_context: nil, detached_spawner: nil) # rubocop:disable Metrics/ParameterLists
  @worker       = worker
  @store_root   = store_root
  @bus          = bus
  @store        = store
  @ctx          = ctx
  @hook_context = hook_context
  @detached_spawner = detached_spawner || default_spawner
end

Instance Method Details

#execute(action, key:) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/textus/application/refresh/orchestrator.rb', line 15

def execute(action, key:)
  case action
  when Textus::Domain::Action::Return       then Textus::Domain::Outcome::Skipped.new
  when Textus::Domain::Action::RefreshSync  then run_sync(key)
  when Textus::Domain::Action::RefreshTimed then run_timed(action.budget_ms, key)
  else raise ArgumentError.new("unknown action: #{action.inspect}")
  end
end