Class: Zeridion::Flare::Worker::RecurringSchedule
- Inherits:
-
Data
- Object
- Data
- Zeridion::Flare::Worker::RecurringSchedule
- Defined in:
- lib/zeridion_flare/worker/recurring_schedule.rb
Overview
One cron schedule announced at register time. This is the single typed wire DTO in the worker — everything else stays loose string-keyed Hashes.
The full 6-field shape from the frozen protocol, including timezone
(absence ⇒ server-default TZ, which runs non-UTC crons at the wrong
local time). #to_wire drops nil fields — Ruby's JSON.generate emits
null for nil values, and the server treats a present-but-null field
differently from an omitted one, so compaction is load-bearing.
Instance Attribute Summary collapse
-
#cron_expression ⇒ Object
readonly
Returns the value of attribute cron_expression.
-
#job_type ⇒ Object
readonly
Returns the value of attribute job_type.
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#timeout_seconds ⇒ Object
readonly
Returns the value of attribute timeout_seconds.
-
#timezone ⇒ Object
readonly
Returns the value of attribute timezone.
Class Method Summary collapse
-
.from_definition(definition) ⇒ Object
Build from a JobDefinition.
Instance Method Summary collapse
-
#to_wire ⇒ Object
Snake-case Hash with nil fields removed (so JSON.generate never emits
"queue": nulletc.).
Instance Attribute Details
#cron_expression ⇒ Object (readonly)
Returns the value of attribute cron_expression
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def cron_expression @cron_expression end |
#job_type ⇒ Object (readonly)
Returns the value of attribute job_type
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def job_type @job_type end |
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def max_attempts @max_attempts end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def queue @queue end |
#timeout_seconds ⇒ Object (readonly)
Returns the value of attribute timeout_seconds
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def timeout_seconds @timeout_seconds end |
#timezone ⇒ Object (readonly)
Returns the value of attribute timezone
14 15 16 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 14 def timezone @timezone end |
Class Method Details
.from_definition(definition) ⇒ Object
Build from a JobDefinition. queue/timezone/max_attempts/timeout_seconds are always populated from the definition's resolved options, so they are sent; only genuinely-absent optionals would be nil.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 25 def self.from_definition(definition) new( job_type: definition.job_type, cron_expression: definition.cron, queue: definition.queue, timezone: definition.timezone, max_attempts: definition.max_attempts, timeout_seconds: definition.timeout_seconds, ) end |
Instance Method Details
#to_wire ⇒ Object
Snake-case Hash with nil fields removed (so JSON.generate never emits
"queue": null etc.).
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/zeridion_flare/worker/recurring_schedule.rb', line 38 def to_wire { "job_type" => job_type, "cron_expression" => cron_expression, "queue" => queue, "timezone" => timezone, "max_attempts" => max_attempts, "timeout_seconds" => timeout_seconds, }.compact end |