Module: Async::Background::Queue

Defined in:
lib/async/background/queue/sql.rb,
lib/async/background/queue/store.rb,
lib/async/background/queue/client.rb,
lib/async/background/queue/schema.rb,
lib/async/background/queue/options.rb,
lib/async/background/queue/notifier.rb,
lib/async/background/queue/socket_waker.rb,
lib/async/background/queue/socket_notifier.rb

Defined Under Namespace

Modules: SQL, Schema Classes: Client, Notifier, SocketNotifier, SocketWaker, Store, StoreOptions

Constant Summary collapse

EMPTY_ARGS =
[].freeze
EMPTY_OPTIONS =
{}.freeze
SYNCHRONOUS_LEVELS =
{normal: 'NORMAL', full: 'FULL', extra: 'EXTRA'}.freeze
WAL_AUTOCHECKPOINT_RANGE =
100..10_000
DEFAULT_STORE_OPTIONS =
{mmap: true, synchronous: :normal, wal_autocheckpoint: 1_000}.freeze
DEFAULTS =
DEFAULT_STORE_OPTIONS
MMAP_SIZE =
268_435_456

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.default_clientObject

Returns the value of attribute default_client.



34
35
36
# File 'lib/async/background/queue/client.rb', line 34

def default_client
  @default_client
end

Class Method Details

.enqueue(job_class, *args, options: EMPTY_OPTIONS) ⇒ Object



44
45
46
47
# File 'lib/async/background/queue/client.rb', line 44

def enqueue(job_class, *args, options: EMPTY_OPTIONS)
  ensure_configured!
  default_client.push(resolve_class_name(job_class), normalized_args(args), nil, options: build_options(job_class, options))
end

.enqueue_at(time, job_class, *args, options: EMPTY_OPTIONS) ⇒ Object



54
55
56
57
# File 'lib/async/background/queue/client.rb', line 54

def enqueue_at(time, job_class, *args, options: EMPTY_OPTIONS)
  ensure_configured!
  default_client.push_at(time, resolve_class_name(job_class), normalized_args(args), options: build_options(job_class, options))
end

.enqueue_in(delay, job_class, *args, options: EMPTY_OPTIONS) ⇒ Object



49
50
51
52
# File 'lib/async/background/queue/client.rb', line 49

def enqueue_in(delay, job_class, *args, options: EMPTY_OPTIONS)
  ensure_configured!
  default_client.push_in(delay, resolve_class_name(job_class), normalized_args(args), options: build_options(job_class, options))
end

.migrate!(path: Store.default_path, options: {}) ⇒ Object



36
37
38
# File 'lib/async/background/queue/client.rb', line 36

def migrate!(path: Store.default_path, options: {})
  Store.migrate!(path: path, options: options)
end

.prepare_dashboard!(path: Store.default_path, options: {}) ⇒ Object



40
41
42
# File 'lib/async/background/queue/client.rb', line 40

def prepare_dashboard!(path: Store.default_path, options: {})
  Store.prepare_dashboard!(path: path, options: options)
end