Class: Vidibus::Recording::MonitoringJob
- Inherits:
-
Object
- Object
- Vidibus::Recording::MonitoringJob
- Defined in:
- lib/vidibus/recording/monitoring_job.rb
Constant Summary collapse
- INTERVAL =
10.seconds
Class Method Summary collapse
-
.create(args) ⇒ Object
Returns job.
Instance Method Summary collapse
-
#initialize(args) ⇒ MonitoringJob
constructor
A new instance of MonitoringJob.
- #perform ⇒ Object
Constructor Details
#initialize(args) ⇒ MonitoringJob
Returns a new instance of MonitoringJob.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vidibus/recording/monitoring_job.rb', line 5 def initialize(args) unless @uuid = args[:uuid] raise(ArgumentError, 'No recording UUID given') end unless @class_name = args[:class_name] raise(ArgumentError, 'Must provide class name of recording') end unless @identifier = args[:identifier] raise(ArgumentError, 'Must provide identifier of monitoring job') end ensure_recording end |
Class Method Details
.create(args) ⇒ Object
Returns job
30 31 32 33 |
# File 'lib/vidibus/recording/monitoring_job.rb', line 30 def self.create(args) job = new(args) Delayed::Job.enqueue(job) end |
Instance Method Details
#perform ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vidibus/recording/monitoring_job.rb', line 18 def perform r = recording.reload return unless r.monitoring_job_identifier == @identifier if r.worker_running? r.track_progress run_again elsif !r.stopped? r.resume end end |