Module: ProviderKit::Execution

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Rescuable
Included in:
JsonRequest
Defined in:
lib/provider_kit/execution.rb

Overview

Handles the execution of Tasks

Includes callbacks for the perform method, so the following callbacks are available:

  • before_perform
  • around_perform
  • after_perform

Also included is Rescuable, so an individual task can be rescued like a job:

rescue_from InvalidProviderContext do
 logger.warn "Provider context was not found for this task"
end

Instance Method Summary collapse

Instance Method Details

#performObject



35
36
37
# File 'lib/provider_kit/execution.rb', line 35

def perform
  fail NotImplementedError
end

#perform_nowObject



25
26
27
28
29
30
31
32
33
# File 'lib/provider_kit/execution.rb', line 25

def perform_now
  run_callbacks :perform do
    perform
  end
rescue => exception
  tag_logger(self.class.name, process_id) do
    rescue_with_handler(exception) || raise
  end
end