Class: Textus::Application::Refresh::Worker
- Inherits:
-
Object
- Object
- Textus::Application::Refresh::Worker
- Defined in:
- lib/textus/application/refresh/worker.rb
Constant Summary collapse
- FETCH_TIMEOUT_SECONDS =
30
Instance Method Summary collapse
-
#initialize(ctx:, manifest:, envelope_io:, bus:, store:, authorizer:, hook_context:) ⇒ Worker
constructor
rubocop:disable Metrics/ParameterLists.
- #run(key) ⇒ Object
Constructor Details
#initialize(ctx:, manifest:, envelope_io:, bus:, store:, authorizer:, hook_context:) ⇒ Worker
rubocop:disable Metrics/ParameterLists
9 10 11 12 13 14 15 16 17 |
# File 'lib/textus/application/refresh/worker.rb', line 9 def initialize(ctx:, manifest:, envelope_io:, bus:, store:, authorizer:, hook_context:) # rubocop:disable Metrics/ParameterLists @ctx = ctx @manifest = manifest @envelope_io = envelope_io @bus = bus @store = store @authorizer = @hook_context = hook_context end |
Instance Method Details
#run(key) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/textus/application/refresh/worker.rb', line 19 def run(key) res = @manifest.resolver.resolve(key) mentry = res.entry path = res.path remaining = res.remaining raise UsageError.new("no intake declared for '#{key}'") unless mentry.is_a?(Textus::Manifest::Entry::Intake) before_etag = File.exist?(path) ? Etag.for_file(path) : nil result = fetch_with_bus(key, mentry, remaining) persist_and_notify(key, mentry, result, before_etag) end |