Sha256: 0ab7d825af5203388b184f540ac275689161ba050c799444aa70a49803e5c91b

Contents?: true

Size: 518 Bytes

Versions: 13

Compression:

Stored size: 518 Bytes

Contents

require "crono_trigger/worker"

module CronoTrigger
  module Models
    class Worker < ActiveRecord::Base
      self.table_name = "crono_trigger_workers"

      ALIVE_THRESHOLD = CronoTrigger::Worker::HEARTBEAT_INTERVAL * 5

      enum executor_status: {running: "running", quiet: "quiet", shuttingdown: "shuttingdown", shutdown: "shutdown"}
      serialize :polling_model_names, JSON

      scope :alive_workers, proc { where(arel_table[:last_heartbeated_at].gteq(Time.current - ALIVE_THRESHOLD)) }
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
crono_trigger-0.7.0 lib/crono_trigger/models/worker.rb
crono_trigger-0.6.4 lib/crono_trigger/models/worker.rb
crono_trigger-0.6.3 lib/crono_trigger/models/worker.rb
crono_trigger-0.6.2 lib/crono_trigger/models/worker.rb
crono_trigger-0.6.1 lib/crono_trigger/models/worker.rb
crono_trigger-0.6.0 lib/crono_trigger/models/worker.rb
crono_trigger-0.5.4 lib/crono_trigger/models/worker.rb
crono_trigger-0.5.3 lib/crono_trigger/models/worker.rb
crono_trigger-0.5.2 lib/crono_trigger/models/worker.rb
crono_trigger-0.5.1 lib/crono_trigger/models/worker.rb
crono_trigger-0.5.0 lib/crono_trigger/models/worker.rb
crono_trigger-0.4.0 lib/crono_trigger/models/worker.rb
crono_trigger-0.3.4 lib/crono_trigger/models/worker.rb