mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-04 21:01:27 -05:00
d6d9a7fa09
These are jobs that will run on every host that is running discourse. If you have multiple hosts running the same site you get independent schedules
37 lines
609 B
Ruby
37 lines
609 B
Ruby
module Scheduler::Schedule
|
|
|
|
def daily(options=nil)
|
|
if options
|
|
@daily = options
|
|
end
|
|
@daily
|
|
end
|
|
|
|
def every(duration=nil)
|
|
if duration
|
|
@every = duration
|
|
if manager = Scheduler::Manager.current
|
|
manager.ensure_schedule!(self)
|
|
end
|
|
end
|
|
@every
|
|
end
|
|
|
|
# schedule job indepndently on each host (looking at hostname)
|
|
def per_host
|
|
@per_host = true
|
|
end
|
|
|
|
def is_per_host
|
|
@per_host
|
|
end
|
|
|
|
def schedule_info
|
|
manager = Scheduler::Manager.without_runner
|
|
manager.schedule_info self
|
|
end
|
|
|
|
def scheduled?
|
|
!!@every || !!@daily
|
|
end
|
|
end
|