marj 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -13
- data/lib/marj.rb +1 -1
- data/lib/marj_adapter.rb +6 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fd27db3bb7a04aee0b4e6cf043e35bde5329143194584bcb03b75ef00896f5d
|
4
|
+
data.tar.gz: d89fd27053c6beeb6aeddcaac59fd1a0ddd4b2a481a4dd0f9b96b3cbbbc29bde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b1304cba5e2780fa9fd24432624e37a0a1746efefa9ffaf11573875a2333b1ae9fda8f419b94f30f953c59be0896dae6b90e808b089bbac2324cbe787d2ed8d
|
7
|
+
data.tar.gz: c9b6926e5ef0cad9fc33d510eb9102d570e4ace04322cfc62c44367651a42034c7be5f2dbbf88fc851c13fc6acfc005056d342676bcd505f356696b8fa0305c1
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ A minimal database-backed ActiveJob queueing backend.
|
|
4
4
|
|
5
5
|
## Quick Links
|
6
6
|
|
7
|
-
API docs: https://gemdocs.org/gems/marj/6.
|
7
|
+
API docs: https://gemdocs.org/gems/marj/6.1.0/ <br>
|
8
8
|
RubyGems: https://rubygems.org/gems/marj <br>
|
9
9
|
Changelog: https://github.com/nicholasdower/marj/releases <br>
|
10
10
|
Issues: https://github.com/nicholasdower/marj/issues <br>
|
@@ -61,7 +61,7 @@ Marj relies on existing ActiveJob APIs, for example:
|
|
61
61
|
|
62
62
|
```ruby
|
63
63
|
job.enqueue # Enqueues a job
|
64
|
-
job.perform_now #
|
64
|
+
job.perform_now # Executes a job
|
65
65
|
```
|
66
66
|
|
67
67
|
Additionally, it extends the ActiveJob API with methods required for a
|
@@ -104,6 +104,8 @@ class CreateJobs < ActiveRecord::Migration[7.1]
|
|
104
104
|
table.string :timezone, null: false
|
105
105
|
end
|
106
106
|
|
107
|
+
add_index :jobs, %i[job_class]
|
108
|
+
add_index :jobs, %i[queue_name]
|
107
109
|
add_index :jobs, %i[enqueued_at]
|
108
110
|
add_index :jobs, %i[scheduled_at]
|
109
111
|
add_index :jobs, %i[priority scheduled_at enqueued_at]
|
@@ -161,25 +163,25 @@ end
|
|
161
163
|
job = SomeJob.perform_later('foo')
|
162
164
|
|
163
165
|
# Query jobs
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
Marj.query(:all)
|
167
|
+
Marj.query(:due)
|
168
|
+
Marj.query(:due, queue: :foo)
|
169
|
+
Marj.query('8720417d-8fff-4fcf-bc16-22aaef8543d2')
|
168
170
|
|
169
171
|
# Execute a job
|
170
172
|
job.perform_now
|
171
173
|
|
172
174
|
# Execute jobs which are due (single query)
|
173
|
-
|
175
|
+
Marj.query(:due).map(&:perform_now)
|
174
176
|
|
175
177
|
# Execute jobs which are due (multiple queries)
|
176
|
-
loop
|
177
|
-
|
178
|
+
loop do
|
179
|
+
Marj.query(:due, :first)&.tap(&:perform_now) || break
|
178
180
|
end
|
179
181
|
|
180
182
|
# Execute jobs as they become due
|
181
183
|
loop do
|
182
|
-
|
184
|
+
Marj.query(:due).each(&:perform_now) rescue logger.error($!)
|
183
185
|
ensure
|
184
186
|
sleep 5.seconds
|
185
187
|
end
|
@@ -457,7 +459,7 @@ job = SomeJob.new.deserialize(other_job.serialize)
|
|
457
459
|
job = SomeJob.perform_later
|
458
460
|
job = SomeJob.perform_later(args)
|
459
461
|
|
460
|
-
# Create without enqueueing and run (only enqueued on failure
|
462
|
+
# Create without enqueueing and run (only enqueued on retryable failure)
|
461
463
|
SomeJob.perform_now
|
462
464
|
SomeJob.perform_now(args)
|
463
465
|
```
|
@@ -478,7 +480,7 @@ SomeJob.perform_later(SomeJob.new(args))
|
|
478
480
|
SomeJob.perform_later(args)
|
479
481
|
SomeJob.set(options).perform_later(args)
|
480
482
|
|
481
|
-
# After a
|
483
|
+
# After a retryable execution failure
|
482
484
|
SomeJob.perform_now(args)
|
483
485
|
ActiveJob::Base.execute(SomeJob.new(args).serialize)
|
484
486
|
|
@@ -492,7 +494,7 @@ SomeJob.set(options).perform_all_later(SomeJob.new, SomeJob.new, options:)
|
|
492
494
|
### Executing Jobs
|
493
495
|
|
494
496
|
```ruby
|
495
|
-
# Executed without enqueueing, enqueued on failure
|
497
|
+
# Executed without enqueueing, enqueued on retryable failure
|
496
498
|
SomeJob.new(args).perform_now
|
497
499
|
SomeJob.perform_now(args)
|
498
500
|
ActiveJob::Base.execute(SomeJob.new(args).serialize)
|
data/lib/marj.rb
CHANGED
data/lib/marj_adapter.rb
CHANGED
@@ -24,6 +24,12 @@ class MarjAdapter
|
|
24
24
|
@discard_proc = discard
|
25
25
|
end
|
26
26
|
|
27
|
+
# Returns whether jobs enqueued during a transaction should actually be enqueued only after the
|
28
|
+
# transaction is committed.
|
29
|
+
def enqueue_after_transaction_commit?
|
30
|
+
false
|
31
|
+
end
|
32
|
+
|
27
33
|
# Enqueue a job for immediate execution.
|
28
34
|
#
|
29
35
|
# @param job [ActiveJob::Base] the job to enqueue
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dower
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -56,8 +56,8 @@ licenses:
|
|
56
56
|
- MIT
|
57
57
|
metadata:
|
58
58
|
bug_tracker_uri: https://github.com/nicholasdower/marj/issues
|
59
|
-
changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v6.
|
60
|
-
documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v6.
|
59
|
+
changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v6.1.0
|
60
|
+
documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v6.1.0
|
61
61
|
homepage_uri: https://github.com/nicholasdower/marj
|
62
62
|
rubygems_mfa_required: 'true'
|
63
63
|
source_code_uri: https://github.com/nicholasdower/marj
|