Class: Delayed::JobTracking

Inherits:
Struct
  • Object
show all
Defined in:
lib/delayed/job_tracking.rb

Overview

lot more about what’s going on in Delayed Jobs as it’s needed.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeJobTracking

Returns a new instance of JobTracking.



25
26
27
28
29
# File 'lib/delayed/job_tracking.rb', line 25

def initialize
  super
  self.created = []
  @lock = Mutex.new
end

Instance Attribute Details

#createdObject

Returns the value of attribute created

Returns:

  • (Object)

    the current value of created



7
8
9
# File 'lib/delayed/job_tracking.rb', line 7

def created
  @created
end

Class Method Details

.job_created(job) ⇒ Object



16
17
18
# File 'lib/delayed/job_tracking.rb', line 16

def self.job_created(job)
  @current_tracking.try(:job_created, job)
end

.trackObject



8
9
10
11
12
13
14
# File 'lib/delayed/job_tracking.rb', line 8

def self.track
  @current_tracking = self.new
  yield
  tracking = @current_tracking
  @current_tracking = nil
  tracking
end

Instance Method Details

#job_created(job) ⇒ Object



20
21
22
23
# File 'lib/delayed/job_tracking.rb', line 20

def job_created(job)
  return unless job
  @lock.synchronize { self.created << job }
end