Sha256: 388456bf5a519bc1acbabe52d38f2d2c1cbd57aca4b61f5bb508c2f11f5fee4a

Contents?: true

Size: 445 Bytes

Versions: 10

Compression:

Stored size: 445 Bytes

Contents

class Kuroko2::ProcessSignal < Kuroko2::ApplicationRecord
  include Kuroko2::TableNameCustomizable

  belongs_to :execution

  scope :unstarted, -> { where(started_at: nil) }
  scope :on, ->(hostname) { joins(execution: :worker).merge(Kuroko2::Worker.on(hostname)) }

  def self.poll(hostname)
    self.transaction do
      unstarted.on(hostname).lock.take.tap do |signal|
        signal.touch(:started_at) if signal
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kuroko2-0.8.0 app/models/kuroko2/process_signal.rb
kuroko2-0.7.0 app/models/kuroko2/process_signal.rb
kuroko2-0.6.0 app/models/kuroko2/process_signal.rb
kuroko2-0.5.2 app/models/kuroko2/process_signal.rb
kuroko2-0.5.1 app/models/kuroko2/process_signal.rb
kuroko2-0.5.0 app/models/kuroko2/process_signal.rb
kuroko2-0.4.6 app/models/kuroko2/process_signal.rb
kuroko2-0.4.5 app/models/kuroko2/process_signal.rb
kuroko2-0.4.4 app/models/kuroko2/process_signal.rb
kuroko2-0.4.3 app/models/kuroko2/process_signal.rb