Module: Marj
- Defined in:
- lib/marj.rb,
lib/marj/record.rb,
lib/marj/mission_control.rb
Overview
:nocov:
Defined Under Namespace
Modules: ClassMethods, MissionControl Classes: Record
Constant Summary collapse
- VERSION =
The Marj version.
'6.0.0'
Class Method Summary collapse
-
.delete(job) ⇒ ActiveJob::Base
Deletes the record associated with the specified job.
-
.discard(job) ⇒ ActiveJob::Base
Discards the specified job.
-
.query(*args, **kwargs) ⇒ Object
Queries enqueued jobs.
Instance Method Summary collapse
-
#delete ⇒ ActiveJob::Base
Deletes the record associated with this job.
-
#discard ⇒ ActiveJob::Base
Deletes this job.
Class Method Details
.delete(job) ⇒ ActiveJob::Base
Deletes the record associated with the specified job.
92 93 94 |
# File 'lib/marj.rb', line 92 def self.delete(job) queue_adapter.delete(job) end |
.discard(job) ⇒ ActiveJob::Base
Discards the specified job.
87 88 89 |
# File 'lib/marj.rb', line 87 def self.discard(job) queue_adapter.discard(job) end |
.query(*args, **kwargs) ⇒ Object
Queries enqueued jobs. Similar to ActiveRecord.where
with a few additional features:
-
Symbol arguments are treated as
ActiveRecord
scopes. -
If only a job ID is specified, the corresponding job is returned.
-
If
:limit
is specified, the maximum number of jobs is limited. -
If
:order
is specified, the jobs are ordered by the given attribute.
By default jobs are ordered by when they should be executed.
Example usage:
query # Returns all jobs
query(:all) # Returns all jobs
query(:due) # Returns jobs which are due to be executed
query(:due, limit: 10) # Returns at most 10 jobs which are due to be executed
query(job_class: Foo) # Returns all jobs with job_class Foo
query(:due, job_class: Foo) # Returns jobs which are due to be executed with job_class Foo
query(queue_name: 'foo') # Returns all jobs in the 'foo' queue
query(job_id: '123') # Returns the job with job_id '123' or nil if no such job exists
query('123') # Returns the job with job_id '123' or nil if no such job exists
82 83 84 |
# File 'lib/marj.rb', line 82 def self.query(*args, **kwargs) queue_adapter.query(*args, **kwargs) end |
Instance Method Details
#delete ⇒ ActiveJob::Base
Deletes the record associated with this job.
106 107 108 |
# File 'lib/marj.rb', line 106 def delete self.class.queue_adapter.delete(self) end |
#discard ⇒ ActiveJob::Base
Deletes this job.
99 100 101 |
# File 'lib/marj.rb', line 99 def discard self.class.queue_adapter.discard(self) end |