marj 4.0.0 → 4.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 +5 -6
- data/lib/marj.rb +10 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ea99cb466811e6f77fb6476e7e8ca02b7345c8d297ebdb1954b9109f772bfd9
|
4
|
+
data.tar.gz: 35a1ed99e2afe6934a5a7ea9b40375a93d5c79b9c46d304aac49457913794fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a1568a19c7faeedc80d0a17cf71c536a5dcb9b497645c87772213b5a20ca22b8ae250099826a75654d36260b5d34d77c896b81b28cc87e3ec1e4e181b5440bb
|
7
|
+
data.tar.gz: 701727d777c8f9c990bdca6d66f9cf3d76d41eddddd77f1dbcbb1c75cff5b75b7acce065cb5c83b01c23dff3a6878218b4b6f3c4528d0e307ae8bc8e192d91e9
|
data/README.md
CHANGED
@@ -108,7 +108,7 @@ ensure
|
|
108
108
|
end
|
109
109
|
```
|
110
110
|
|
111
|
-
|
111
|
+
## Jobs Interface
|
112
112
|
|
113
113
|
The `Marj` module provides methods for interacting with enqueued jobs. These
|
114
114
|
methods accept, return and yield +ActiveJob+ objects rather than +ActiveRecord+
|
@@ -135,7 +135,7 @@ Query methods can also be chained:
|
|
135
135
|
Marj.due.where(job_class: SomeJob).next # Returns the next SomeJob that is due
|
136
136
|
```
|
137
137
|
|
138
|
-
|
138
|
+
## Custom Jobs Interface
|
139
139
|
|
140
140
|
The `Marj::JobsInterface` can be added to any class or module. For example, to
|
141
141
|
add it to all jobs classes:
|
@@ -158,11 +158,10 @@ ApplicationJob.due # Returns all jobs which are due to be executed.
|
|
158
158
|
SomeJob.due # Returns SomeJobs which are due to be executed.
|
159
159
|
```
|
160
160
|
|
161
|
-
##
|
161
|
+
## Multiple Tables
|
162
162
|
|
163
|
-
It is possible to create a custom record class
|
164
|
-
|
165
|
-
application.
|
163
|
+
It is possible to create a custom record class in order to, for instance,
|
164
|
+
write jobs to multiple databases/tables within a single application.
|
166
165
|
|
167
166
|
```ruby
|
168
167
|
class CreateMyJobs < ActiveRecord::Migration[7.1]
|
data/lib/marj.rb
CHANGED
@@ -30,7 +30,7 @@ require_relative 'marj/relation'
|
|
30
30
|
# See https://github.com/nicholasdower/marj
|
31
31
|
module Marj
|
32
32
|
# The Marj version.
|
33
|
-
VERSION = '4.
|
33
|
+
VERSION = '4.1.0'
|
34
34
|
|
35
35
|
Kernel.autoload(:Record, File.expand_path(File.join('marj', 'record.rb'), __dir__))
|
36
36
|
|
@@ -87,7 +87,15 @@ module Marj
|
|
87
87
|
# ActiveJob::Base#deserialize expects dates to be strings rather than Time objects.
|
88
88
|
job_data = job_data.to_h { |k, v| [k, %w[enqueued_at scheduled_at].include?(k) ? v&.iso8601 : v] }
|
89
89
|
|
90
|
-
job.
|
90
|
+
job.deserialize(job_data)
|
91
|
+
|
92
|
+
# ActiveJob deserializes arguments on demand when a job is performed. Until then they are empty. That's strange.
|
93
|
+
# Instead, deserialize them now. Also, clear `serialized_arguments` to prevent ActiveJob from overwriting changes
|
94
|
+
# to arguments when serializing later.
|
95
|
+
job.arguments = record.arguments
|
96
|
+
job.serialized_arguments = nil
|
97
|
+
|
98
|
+
job
|
91
99
|
end
|
92
100
|
|
93
101
|
# Registers callbacks for the given job which destroy the given database record when the job succeeds or is
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Dower
|
@@ -57,8 +57,8 @@ licenses:
|
|
57
57
|
- MIT
|
58
58
|
metadata:
|
59
59
|
bug_tracker_uri: https://github.com/nicholasdower/marj/issues
|
60
|
-
changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v4.
|
61
|
-
documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v4.
|
60
|
+
changelog_uri: https://github.com/nicholasdower/marj/releases/tag/v4.1.0
|
61
|
+
documentation_uri: https://www.rubydoc.info/github/nicholasdower/marj/v4.1.0
|
62
62
|
homepage_uri: https://github.com/nicholasdower/marj
|
63
63
|
rubygems_mfa_required: 'true'
|
64
64
|
source_code_uri: https://github.com/nicholasdower/marj
|