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:, envelope_io:) ⇒ Worker
constructor
A new instance of Worker.
- #run(key) ⇒ Object
Constructor Details
#initialize(ctx:, envelope_io:) ⇒ Worker
Returns a new instance of Worker.
9 10 11 12 |
# File 'lib/textus/application/refresh/worker.rb', line 9 def initialize(ctx:, envelope_io:) @ctx = ctx @envelope_io = envelope_io end |
Instance Method Details
#run(key) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/textus/application/refresh/worker.rb', line 14 def run(key) res = @ctx.store.manifest.resolve(key) mentry = res.entry path = res.path remaining = res.remaining raise UsageError.new("no intake declared for '#{key}'") unless mentry.intake_handler 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 |