Class: Gouda::ExceptQueueConstraint

Inherits:
Struct
  • Object
show all
Defined in:
lib/gouda/queue_constraints.rb

Overview

Allows execution of jobs from queues except the given ones For example, if you have a queue named “emails” which is time-critical, on all other machines your worker script can specify ‘ExceptQueueConstraint.new()`

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#queue_namesObject

Returns the value of attribute queue_names

Returns:

  • (Object)

    the current value of queue_names



32
33
34
# File 'lib/gouda/queue_constraints.rb', line 32

def queue_names
  @queue_names
end

Instance Method Details

#to_sqlObject



33
34
35
36
37
38
# File 'lib/gouda/queue_constraints.rb', line 33

def to_sql
  placeholders = (["?"] * queue_names.length).join(",")
  Gouda::Workload.sanitize_sql_array([<<~SQL, *queue_names])
    queue_name NOT IN (#{placeholders})
  SQL
end