Module: Que
- Extended by:
- Forwardable, Utils::Assertions, Utils::Constantization, Utils::ErrorNotification, Utils::Freeze, Utils::Introspection, Utils::JSONSerialization, Utils::Logging, Utils::Middleware, Utils::QueueManagement, Utils::Ruby2Keywords, Utils::Transactions
- Defined in:
- lib/que/job.rb,
lib/que.rb,
lib/que/locker.rb,
lib/que/poller.rb,
lib/que/worker.rb,
lib/que/metajob.rb,
lib/que/version.rb,
lib/que/listener.rb,
lib/que/connection.rb,
lib/que/job_buffer.rb,
lib/que/migrations.rb,
lib/que/job_methods.rb,
lib/que/result_queue.rb,
lib/que/sequel/model.rb,
lib/que/utils/freeze.rb,
lib/que/rails/railtie.rb,
lib/que/utils/logging.rb,
lib/que/connection_pool.rb,
lib/que/utils/assertions.rb,
lib/que/utils/middleware.rb,
lib/que/utils/transactions.rb,
lib/que/active_record/model.rb,
lib/que/utils/introspection.rb,
lib/que/utils/ruby2_keywords.rb,
lib/que/active_job/extensions.rb,
lib/que/utils/constantization.rb,
lib/que/command_line_interface.rb,
lib/que/utils/queue_management.rb,
lib/que/active_record/connection.rb,
lib/que/utils/error_notification.rb,
lib/que/utils/json_serialization.rb
Overview
Tools for managing the contents/state of the queue.
Defined Under Namespace
Modules: ActiveJob, ActiveRecord, CommandLineInterface, JobMethods, Migrations, Rails, Sequel, Utils Classes: Connection, ConnectionPool, Error, Job, JobBuffer, Listener, Locker, Metajob, Poller, ResultQueue, Worker
Constant Summary collapse
- CURRENT_HOSTNAME =
Socket.gethostname.freeze
- DEFAULT_QUEUE =
'default'.freeze
- TIME_REGEX =
/\A\d{4}\-\d{2}\-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}Z\z/
- CONFIG_MUTEX =
Mutex.new
- MAXIMUM_PRIORITY =
32767
- SQL =
Store SQL strings frozen, with squashed whitespace so logs read better.
{}
- VERSION =
'2.4.1'
Constants included from Utils::Middleware
Constants included from Utils::ErrorNotification
Utils::ErrorNotification::ASYNC_QUEUE, Utils::ErrorNotification::MAX_QUEUE_SIZE
Class Attribute Summary collapse
- .default_queue ⇒ Object
-
.locker ⇒ Object
Returns the value of attribute locker.
-
.pool ⇒ Object
How to actually access Que’s established connection pool.
-
.use_prepared_statements ⇒ Object
Global configuration logic.
Attributes included from Utils::Logging
#internal_logger, #log_formatter, #logger
Attributes included from Utils::ErrorNotification
Class Method Summary collapse
-
.connection=(conn) ⇒ Object
Support simple integration with many common connection pools.
-
.connection_proc=(connection_proc) ⇒ Object
Integrate Que with any connection pool by passing it a reentrant block that locks and yields a Postgres connection.
- .job_schema_version ⇒ Object
- .server? ⇒ Boolean
Methods included from Utils::Transactions
Methods included from Utils::Ruby2Keywords
Methods included from Utils::QueueManagement
Methods included from Utils::Logging
Methods included from Utils::JSONSerialization
deserialize_json, serialize_json
Methods included from Utils::Introspection
Methods included from Utils::Freeze
Methods included from Utils::ErrorNotification
async_error_thread, notify_error, notify_error_async
Methods included from Utils::Constantization
Methods included from Utils::Assertions
Class Attribute Details
.default_queue ⇒ Object
78 79 80 |
# File 'lib/que.rb', line 78 def default_queue @default_queue || DEFAULT_QUEUE end |
.locker ⇒ Object
Returns the value of attribute locker.
11 12 13 |
# File 'lib/que/locker.rb', line 11 def locker @locker end |
.pool ⇒ Object
How to actually access Que’s established connection pool.
113 114 115 |
# File 'lib/que.rb', line 113 def pool @pool || raise(Error, "Que connection not established!") end |
.use_prepared_statements ⇒ Object
Global configuration logic.
76 77 78 |
# File 'lib/que.rb', line 76 def use_prepared_statements @use_prepared_statements end |
Class Method Details
.connection=(conn) ⇒ Object
Support simple integration with many common connection pools.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/que.rb', line 87 def connection=(conn) self.connection_proc = if conn.to_s == 'ActiveRecord' # Load and setup AR compatibility. require_relative 'que/active_record/connection' m = Que::ActiveRecord::Connection::JobMiddleware job_middleware << m unless job_middleware.include?(m) Que::ActiveRecord::Connection.method(:checkout) else case conn.class.to_s when 'Sequel::Postgres::Database' then conn.method(:synchronize) when 'Pond' then conn.method(:checkout) when 'ConnectionPool' then conn.method(:with) when 'NilClass' then conn else raise Error, "Unsupported connection: #{conn.class}" end end end |
.connection_proc=(connection_proc) ⇒ Object
Integrate Que with any connection pool by passing it a reentrant block that locks and yields a Postgres connection.
108 109 110 |
# File 'lib/que.rb', line 108 def connection_proc=(connection_proc) @pool = connection_proc && ConnectionPool.new(&connection_proc) end |
.job_schema_version ⇒ Object
6 7 8 |
# File 'lib/que/version.rb', line 6 def self.job_schema_version 2 end |
.server? ⇒ Boolean
82 83 84 |
# File 'lib/que.rb', line 82 def server? !defined?(Que::CommandLineInterface).nil? end |