Module: Maxwell::Agent::Work
Defined Under Namespace
Classes: MissingRequiredAttributeError
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Method Details
#evented? ⇒ Boolean
35
36
37
|
# File 'lib/maxwell/agent/work.rb', line 35
def evented?
work_class.work_type == :evented
end
|
#expected_next_run ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/maxwell/agent/work.rb', line 19
def expected_next_run
case
when perform_at then perform_at + last_run.to_i
when (last_run && frequency) then last_run + frequency
else Time.new(0)
end
end
|
#generate_rank ⇒ Object
27
28
29
|
# File 'lib/maxwell/agent/work.rb', line 27
def generate_rank
expected_next_run.to_i
end
|
31
32
33
|
# File 'lib/maxwell/agent/work.rb', line 31
def perform
work_class.perform(*arguments)
end
|
#verify_required_attributes! ⇒ Object
39
40
41
42
43
|
# File 'lib/maxwell/agent/work.rb', line 39
def verify_required_attributes!
case
when work_class.nil? then raise MissingRequiredAttributeError
end
end
|
#work_now? ⇒ Boolean
11
12
13
14
15
16
17
|
# File 'lib/maxwell/agent/work.rb', line 11
def work_now?
case
when perform_at then perform_at_less_than_now?
when frequency then stale?
else true
end
end
|