Class: Nppes::Jobs::SearcherJob

Inherits:
Struct
  • Object
show all
Defined in:
lib/nppes/jobs/searcher_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#periodObject

Returns the value of attribute period

Returns:

  • (Object)

    the current value of period



3
4
5
# File 'lib/nppes/jobs/searcher_job.rb', line 3

def period
  @period
end

Instance Method Details

#after(job) ⇒ Object



13
14
15
16
17
18
# File 'lib/nppes/jobs/searcher_job.rb', line 13

def after(job)
  if period
    Nppes.logger.warn 'Create next update job'
    Delayed::Job.enqueue(Nppes::Jobs::SearcherJob.new(period), 0, Time.now + period)
  end
end

#performObject



4
5
6
# File 'lib/nppes/jobs/searcher_job.rb', line 4

def perform
  UpdatePack::Pack.check_updates
end

#reschedule_at(time, attempts) ⇒ Object

not tested



8
9
10
11
# File 'lib/nppes/jobs/searcher_job.rb', line 8

def reschedule_at(time, attempts)
  Nppes.logger.warn 'Rescheduling'
  time + 2.hours
end