Class: Rivendell::Import::Worker
- Inherits:
-
Object
- Object
- Rivendell::Import::Worker
- Defined in:
- lib/rivendell/import/worker.rb
Instance Attribute Summary collapse
-
#import ⇒ Object
readonly
Returns the value of attribute import.
Instance Method Summary collapse
-
#initialize(import) ⇒ Worker
constructor
A new instance of Worker.
- #run ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(import) ⇒ Worker
Returns a new instance of Worker.
6 7 8 |
# File 'lib/rivendell/import/worker.rb', line 6 def initialize(import) @import = import end |
Instance Attribute Details
#import ⇒ Object (readonly)
Returns the value of attribute import.
4 5 6 |
# File 'lib/rivendell/import/worker.rb', line 4 def import @import end |
Instance Method Details
#run ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rivendell/import/worker.rb', line 19 def run loop do begin task = import.tasks.pop if task task.run else # Rivendell::Import.logger.debug "No pending task, sleep 10s" sleep 10 end rescue Exception => e Rivendell::Import.logger.error "Worker failed : #{e}" sleep 10 end end end |