Module: Zeridion::Flare::RecurringJob
- Defined in:
- lib/zeridion_flare/worker/recurring_job.rb
Overview
Mixin marking a class as a payloadless recurring (cron) job:
class NightlyCleanup
include Zeridion::Flare::RecurringJob
cron: "0 3 * * *", queue: "maintenance", timezone: "UTC"
def perform(ctx)
return if ctx.cancelled?
PurgeExpired.run
end
end
The server runs the schedule and enqueues an execution per tick; the worker
announces the schedule (including timezone) at register time and then
dispatches the resulting jobs to #perform(ctx) — note the single-arg
signature (no payload).
cron is required (a recurring job with no schedule never fires). job_type
defaults to the class FQN.
Defined Under Namespace
Modules: ClassMacros, InstanceShape
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
25 26 27 28 29 |
# File 'lib/zeridion_flare/worker/recurring_job.rb', line 25 def self.included(base) base.extend(ClassMacros) base.include(InstanceShape) Worker::Registry.register_recurring(base) end |