active_job-performs 0.3.3 → 0.4.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/Gemfile +1 -1
- data/Gemfile.lock +52 -34
- data/README.md +12 -11
- data/lib/active_job/performs/version.rb +1 -1
- data/lib/active_job/performs.rb +0 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 673105da38e705ba9aa778566a9d711a631aea27467a354a4fc4413e16b31ac3
|
|
4
|
+
data.tar.gz: 632442f9d0c25be20d47ecc4038b8d36e20d2b4797b5a1b622d3b5dead074cc4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f1569149e481246401f737e48a032d6d579bdfcf39751daafc5b4991eecd7017a3e646ed573101d8c65ae6acf36b371c75bf2ed793fa22fef77fd5ca93fa25d
|
|
7
|
+
data.tar.gz: f1df1f52d96bc4fff67af97b1f675669da1eec01423b48ecc36451e2c290111d205ef839da6abe36929ba3edf685998a473f73ee55f3b01286a2df083ebfa988
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -7,59 +7,77 @@ PATH
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
activejob (
|
|
11
|
-
activesupport (=
|
|
10
|
+
activejob (8.1.1)
|
|
11
|
+
activesupport (= 8.1.1)
|
|
12
12
|
globalid (>= 0.3.6)
|
|
13
|
-
activemodel (
|
|
14
|
-
activesupport (=
|
|
15
|
-
activerecord (
|
|
16
|
-
activemodel (=
|
|
17
|
-
activesupport (=
|
|
13
|
+
activemodel (8.1.1)
|
|
14
|
+
activesupport (= 8.1.1)
|
|
15
|
+
activerecord (8.1.1)
|
|
16
|
+
activemodel (= 8.1.1)
|
|
17
|
+
activesupport (= 8.1.1)
|
|
18
18
|
timeout (>= 0.4.0)
|
|
19
|
-
activesupport (
|
|
19
|
+
activesupport (8.1.1)
|
|
20
20
|
base64
|
|
21
21
|
bigdecimal
|
|
22
|
-
concurrent-ruby (~> 1.0, >= 1.
|
|
22
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
23
23
|
connection_pool (>= 2.2.5)
|
|
24
24
|
drb
|
|
25
25
|
i18n (>= 1.6, < 2)
|
|
26
|
+
json
|
|
27
|
+
logger (>= 1.4.2)
|
|
26
28
|
minitest (>= 5.1)
|
|
27
|
-
|
|
28
|
-
tzinfo (~> 2.0)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
securerandom (>= 0.3)
|
|
30
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
|
+
uri (>= 0.13.1)
|
|
32
|
+
base64 (0.3.0)
|
|
33
|
+
bigdecimal (3.3.1)
|
|
34
|
+
concurrent-ruby (1.3.5)
|
|
35
|
+
connection_pool (2.5.5)
|
|
36
|
+
date (3.5.0)
|
|
37
|
+
debug (1.11.0)
|
|
34
38
|
irb (~> 1.10)
|
|
35
39
|
reline (>= 0.3.8)
|
|
36
|
-
drb (2.2.
|
|
37
|
-
|
|
40
|
+
drb (2.2.3)
|
|
41
|
+
erb (6.0.0)
|
|
42
|
+
globalid (1.3.0)
|
|
38
43
|
activesupport (>= 6.1)
|
|
39
|
-
i18n (1.14.
|
|
44
|
+
i18n (1.14.7)
|
|
40
45
|
concurrent-ruby (~> 1.0)
|
|
41
|
-
io-console (0.
|
|
42
|
-
irb (1.
|
|
46
|
+
io-console (0.8.1)
|
|
47
|
+
irb (1.15.3)
|
|
48
|
+
pp (>= 0.6.0)
|
|
43
49
|
rdoc (>= 4.0.0)
|
|
44
50
|
reline (>= 0.4.2)
|
|
45
|
-
|
|
46
|
-
|
|
51
|
+
json (2.16.0)
|
|
52
|
+
logger (1.7.0)
|
|
53
|
+
minitest (5.26.2)
|
|
54
|
+
minitest-sprint (1.4.1)
|
|
47
55
|
path_expander (~> 1.1)
|
|
48
|
-
|
|
49
|
-
path_expander (1.1.
|
|
50
|
-
|
|
56
|
+
prism (~> 1.5)
|
|
57
|
+
path_expander (1.1.3)
|
|
58
|
+
pp (0.6.3)
|
|
59
|
+
prettyprint
|
|
60
|
+
prettyprint (0.2.0)
|
|
61
|
+
prism (1.6.0)
|
|
62
|
+
psych (5.2.6)
|
|
63
|
+
date
|
|
51
64
|
stringio
|
|
52
|
-
rake (13.
|
|
53
|
-
rdoc (6.
|
|
65
|
+
rake (13.3.1)
|
|
66
|
+
rdoc (6.16.1)
|
|
67
|
+
erb
|
|
54
68
|
psych (>= 4.0.0)
|
|
55
|
-
|
|
69
|
+
tsort
|
|
70
|
+
reline (0.6.3)
|
|
56
71
|
io-console (~> 0.5)
|
|
57
|
-
|
|
58
|
-
sqlite3 (
|
|
59
|
-
|
|
60
|
-
|
|
72
|
+
securerandom (0.4.1)
|
|
73
|
+
sqlite3 (2.8.0-arm64-darwin)
|
|
74
|
+
sqlite3 (2.8.0-x86_64-linux-gnu)
|
|
75
|
+
stringio (3.1.8)
|
|
76
|
+
timeout (0.4.4)
|
|
77
|
+
tsort (0.2.0)
|
|
61
78
|
tzinfo (2.0.6)
|
|
62
79
|
concurrent-ruby (~> 1.0)
|
|
80
|
+
uri (1.1.1)
|
|
63
81
|
|
|
64
82
|
PLATFORMS
|
|
65
83
|
arm64-darwin
|
|
@@ -73,7 +91,7 @@ DEPENDENCIES
|
|
|
73
91
|
minitest (~> 5.0)
|
|
74
92
|
minitest-sprint
|
|
75
93
|
rake (~> 13.0)
|
|
76
|
-
sqlite3
|
|
94
|
+
sqlite3
|
|
77
95
|
|
|
78
96
|
BUNDLED WITH
|
|
79
97
|
2.5.14
|
data/README.md
CHANGED
|
@@ -192,8 +192,7 @@ If there's an Active Record method that you'd like any model to be able to run f
|
|
|
192
192
|
class ApplicationRecord < ActiveRecord::Base
|
|
193
193
|
self.abstract_class = true
|
|
194
194
|
|
|
195
|
-
# We're passing specific queues for monitoring, but
|
|
196
|
-
performs :touch, queue_as: "active_record.touch"
|
|
195
|
+
# We're passing specific queues for monitoring, but they're optional.
|
|
197
196
|
performs :update, queue_as: "active_record.update"
|
|
198
197
|
performs :destroy, queue_as: "active_record.destroy"
|
|
199
198
|
end
|
|
@@ -202,19 +201,21 @@ end
|
|
|
202
201
|
Then a model could now run things like:
|
|
203
202
|
|
|
204
203
|
```ruby
|
|
205
|
-
record.
|
|
206
|
-
record.touch_later :reminded_at, time: 5.minutes.from_now # Pass supported arguments to `touch`
|
|
207
|
-
|
|
208
|
-
record.update_later reminded_at: 1.year.ago
|
|
209
|
-
|
|
210
|
-
# Particularly handy to use on a record with many `dependent: :destroy` associations.
|
|
211
|
-
# Plus if anything fails, the transaction will rollback and the job fails, so you can retry it later!
|
|
204
|
+
record.update_later reminded_at: 1.year.ago # Forward along arguments to the eventual `update` call.
|
|
212
205
|
record.destroy_later
|
|
213
206
|
```
|
|
214
207
|
|
|
215
|
-
|
|
208
|
+
> [!TIP]
|
|
209
|
+
> `destroy_later` could be particularly useful on a record with many `dependent: :destroy` associations.
|
|
210
|
+
> If anything fails, the transaction will rollback and the job fails, so you can retry it later!
|
|
211
|
+
|
|
212
|
+
> [!NOTE]
|
|
213
|
+
> Maybe you'd rather architect your system such that these methods don't have so many side-effects, but having the option can be handy.
|
|
214
|
+
|
|
215
|
+
> [!WARNING]
|
|
216
|
+
> Don't use this pattern with `touch` because Rails has an internal [touch_later](https://github.com/rails/rails/blob/690ec8898318b8f50714e86676353ebe1551261e/activerecord/lib/active_record/touch_later.rb#L11) private API method used in `belongs_to <some_association>, touch: true` assocations. If your model is one day used in such an assocation and you were using this pattern your app would break.
|
|
216
217
|
|
|
217
|
-
|
|
218
|
+
I haven't tested all the Active Record methods, so please file an issue if you encounter any.
|
|
218
219
|
|
|
219
220
|
#### Method suffixes
|
|
220
221
|
|
data/lib/active_job/performs.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: active_job-performs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kasper Timm Hansen
|
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
60
|
version: '0'
|
|
61
61
|
requirements: []
|
|
62
|
-
rubygems_version: 3.
|
|
62
|
+
rubygems_version: 3.7.2
|
|
63
63
|
specification_version: 4
|
|
64
64
|
summary: ActiveJob::Performs adds the `performs` macro to set up jobs by convention.
|
|
65
65
|
test_files: []
|