eventsimple 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 989aab149125d77a97510193a1905233eef5714a798a821e14fa7697247b5403
4
- data.tar.gz: 7dc3276c03f6ab9617733ef292297ba2e5dc9b414c5d221621b2bed5a8635151
3
+ metadata.gz: c32b996ad44adbf1ae144adaa855a70d23c68286ff64e3bc633f8af98517c1f6
4
+ data.tar.gz: 8de726b86bb3fcd0b30c1f580168abfa069f7a9910fc72ce1a5f943da624fb6c
5
5
  SHA512:
6
- metadata.gz: a378b62e0dc1e50540b85f002b06d5a8ff8b17d338b9b7a860d97f630538c919dde28bd1ff44c1d0ef62e29044e26f11089115e03bbd08545c60566fd893a9c5
7
- data.tar.gz: 34cd12770a08ff80b4c6e7ee6e01e0c8e347415d7303ee646d4328a734ca2214180cd64e223e38fe7bae1bb6f39a702aa44ad2dc9e440677cd42e3ce1424618b
6
+ metadata.gz: d85d69406ceb52536ee95b74449fcca0fcb592b58dd8497288c60072945550df3824e5c2ef9e4ffd2b7ae7d32cbd00a023c6a5d7314b5fd55ca6132b5dde9904
7
+ data.tar.gz: 8ccffafa78b30f253e1e47e90f747bfa3ddd240aba2269dd7952e48016fa58750f976b13afe7624318c2146e9447fe32c85516daca371d4b5d127a92dd896890
data/CHANGELOG.md CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 1.2.0 - 2023-09-26
10
+ ### Changed
11
+ - Fix issue where the reactor worker might not work correctly for models not inheriting from ApplicationRecord.
12
+
13
+ ## 1.1.3 - 2023-07-07
14
+ ### Changed
15
+ - Sidekiq is no longer a required dependency.
16
+
9
17
  ## 1.1.2 - 2023-06-22
10
18
  ### Changed
11
19
  - Fix exception noise generated by early global_id desrialization
data/Gemfile.lock CHANGED
@@ -1,85 +1,85 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (1.1.2)
4
+ eventsimple (1.2.0)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  pg (~> 1.4)
8
8
  rails (~> 7.0)
9
9
  retriable (~> 3.1)
10
- sidekiq (~> 7.0)
11
10
 
12
11
  GEM
13
12
  remote: https://rubygems.org/
14
13
  specs:
15
- actioncable (7.0.5)
16
- actionpack (= 7.0.5)
17
- activesupport (= 7.0.5)
14
+ actioncable (7.0.8)
15
+ actionpack (= 7.0.8)
16
+ activesupport (= 7.0.8)
18
17
  nio4r (~> 2.0)
19
18
  websocket-driver (>= 0.6.1)
20
- actionmailbox (7.0.5)
21
- actionpack (= 7.0.5)
22
- activejob (= 7.0.5)
23
- activerecord (= 7.0.5)
24
- activestorage (= 7.0.5)
25
- activesupport (= 7.0.5)
19
+ actionmailbox (7.0.8)
20
+ actionpack (= 7.0.8)
21
+ activejob (= 7.0.8)
22
+ activerecord (= 7.0.8)
23
+ activestorage (= 7.0.8)
24
+ activesupport (= 7.0.8)
26
25
  mail (>= 2.7.1)
27
26
  net-imap
28
27
  net-pop
29
28
  net-smtp
30
- actionmailer (7.0.5)
31
- actionpack (= 7.0.5)
32
- actionview (= 7.0.5)
33
- activejob (= 7.0.5)
34
- activesupport (= 7.0.5)
29
+ actionmailer (7.0.8)
30
+ actionpack (= 7.0.8)
31
+ actionview (= 7.0.8)
32
+ activejob (= 7.0.8)
33
+ activesupport (= 7.0.8)
35
34
  mail (~> 2.5, >= 2.5.4)
36
35
  net-imap
37
36
  net-pop
38
37
  net-smtp
39
38
  rails-dom-testing (~> 2.0)
40
- actionpack (7.0.5)
41
- actionview (= 7.0.5)
42
- activesupport (= 7.0.5)
39
+ actionpack (7.0.8)
40
+ actionview (= 7.0.8)
41
+ activesupport (= 7.0.8)
43
42
  rack (~> 2.0, >= 2.2.4)
44
43
  rack-test (>= 0.6.3)
45
44
  rails-dom-testing (~> 2.0)
46
45
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
47
- actiontext (7.0.5)
48
- actionpack (= 7.0.5)
49
- activerecord (= 7.0.5)
50
- activestorage (= 7.0.5)
51
- activesupport (= 7.0.5)
46
+ actiontext (7.0.8)
47
+ actionpack (= 7.0.8)
48
+ activerecord (= 7.0.8)
49
+ activestorage (= 7.0.8)
50
+ activesupport (= 7.0.8)
52
51
  globalid (>= 0.6.0)
53
52
  nokogiri (>= 1.8.5)
54
- actionview (7.0.5)
55
- activesupport (= 7.0.5)
53
+ actionview (7.0.8)
54
+ activesupport (= 7.0.8)
56
55
  builder (~> 3.1)
57
56
  erubi (~> 1.4)
58
57
  rails-dom-testing (~> 2.0)
59
58
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
60
- activejob (7.0.5)
61
- activesupport (= 7.0.5)
59
+ activejob (7.0.8)
60
+ activesupport (= 7.0.8)
62
61
  globalid (>= 0.3.6)
63
- activemodel (7.0.5)
64
- activesupport (= 7.0.5)
65
- activerecord (7.0.5)
66
- activemodel (= 7.0.5)
67
- activesupport (= 7.0.5)
68
- activestorage (7.0.5)
69
- actionpack (= 7.0.5)
70
- activejob (= 7.0.5)
71
- activerecord (= 7.0.5)
72
- activesupport (= 7.0.5)
62
+ activemodel (7.0.8)
63
+ activesupport (= 7.0.8)
64
+ activerecord (7.0.8)
65
+ activemodel (= 7.0.8)
66
+ activesupport (= 7.0.8)
67
+ activestorage (7.0.8)
68
+ actionpack (= 7.0.8)
69
+ activejob (= 7.0.8)
70
+ activerecord (= 7.0.8)
71
+ activesupport (= 7.0.8)
73
72
  marcel (~> 1.0)
74
73
  mini_mime (>= 1.1.0)
75
- activesupport (7.0.5)
74
+ activesupport (7.0.8)
76
75
  concurrent-ruby (~> 1.0, >= 1.0.2)
77
76
  i18n (>= 1.6, < 2)
78
77
  minitest (>= 5.1)
79
78
  tzinfo (~> 2.0)
80
- addressable (2.8.4)
79
+ addressable (2.8.5)
81
80
  public_suffix (>= 2.0.2, < 6.0)
82
81
  ast (2.4.2)
82
+ base64 (0.1.1)
83
83
  builder (3.2.4)
84
84
  bundle-audit (0.1.0)
85
85
  bundler-audit
@@ -88,11 +88,10 @@ GEM
88
88
  thor (~> 1.0)
89
89
  coderay (1.1.3)
90
90
  concurrent-ruby (1.2.2)
91
- connection_pool (2.4.1)
92
91
  crass (1.0.6)
93
92
  date (3.3.3)
94
93
  diff-lcs (1.5.0)
95
- dry-core (1.0.0)
94
+ dry-core (1.0.1)
96
95
  concurrent-ruby (~> 1.0)
97
96
  zeitwerk (~> 2.6)
98
97
  dry-inflector (1.0.0)
@@ -112,7 +111,7 @@ GEM
112
111
  dry-logic (~> 1.4)
113
112
  zeitwerk (~> 2.6)
114
113
  erubi (1.12.0)
115
- ffi (1.15.5)
114
+ ffi (1.16.2)
116
115
  formatador (1.1.0)
117
116
  fuubar (2.5.1)
118
117
  rspec-core (~> 3.0)
@@ -120,9 +119,9 @@ GEM
120
119
  git (1.18.0)
121
120
  addressable (~> 2.8)
122
121
  rchardet (~> 1.8)
123
- globalid (1.1.0)
124
- activesupport (>= 5.0)
125
- guard (2.18.0)
122
+ globalid (1.2.1)
123
+ activesupport (>= 6.1)
124
+ guard (2.18.1)
126
125
  formatador (>= 0.2.4)
127
126
  listen (>= 2.7, < 4.0)
128
127
  lumberjack (>= 1.0.12, < 2.0)
@@ -141,14 +140,14 @@ GEM
141
140
  ice_nine (0.11.2)
142
141
  json (2.6.3)
143
142
  language_server-protocol (3.17.0.3)
144
- lint_roller (1.0.0)
143
+ lint_roller (1.1.0)
145
144
  listen (3.8.0)
146
145
  rb-fsevent (~> 0.10, >= 0.10.3)
147
146
  rb-inotify (~> 0.9, >= 0.9.10)
148
147
  loofah (2.21.3)
149
148
  crass (~> 1.0.2)
150
149
  nokogiri (>= 1.12.0)
151
- lumberjack (1.2.8)
150
+ lumberjack (1.2.9)
152
151
  mail (2.8.1)
153
152
  mini_mime (>= 0.1.1)
154
153
  net-imap
@@ -156,67 +155,68 @@ GEM
156
155
  net-smtp
157
156
  marcel (1.0.2)
158
157
  method_source (1.0.0)
159
- mini_mime (1.1.2)
160
- minitest (5.18.0)
158
+ mini_mime (1.1.5)
159
+ minitest (5.20.0)
161
160
  nenv (0.3.0)
162
- net-imap (0.3.6)
161
+ net-imap (0.3.7)
163
162
  date
164
163
  net-protocol
165
164
  net-pop (0.1.2)
166
165
  net-protocol
167
166
  net-protocol (0.2.1)
168
167
  timeout
169
- net-smtp (0.3.3)
168
+ net-smtp (0.4.0)
170
169
  net-protocol
171
170
  nio4r (2.5.9)
172
- nokogiri (1.15.2-arm64-darwin)
171
+ nokogiri (1.15.4-arm64-darwin)
173
172
  racc (~> 1.4)
174
- nokogiri (1.15.2-x86_64-linux)
173
+ nokogiri (1.15.4-x86_64-linux)
175
174
  racc (~> 1.4)
176
175
  notiffany (0.1.3)
177
176
  nenv (~> 0.1)
178
177
  shellany (~> 0.0)
179
178
  parallel (1.23.0)
180
- parse_a_changelog (1.2.0)
179
+ parse_a_changelog (1.3.0)
181
180
  treetop (~> 1.6)
182
181
  parser (3.2.2.3)
183
182
  ast (~> 2.4.1)
184
183
  racc
185
- pg (1.5.3)
184
+ pg (1.5.4)
186
185
  polyglot (0.3.5)
187
186
  pry (0.14.2)
188
187
  coderay (~> 1.1)
189
188
  method_source (~> 1.0)
190
- public_suffix (5.0.1)
191
- puma (6.3.0)
189
+ public_suffix (5.0.3)
190
+ puma (6.4.0)
192
191
  nio4r (~> 2.0)
193
- racc (1.7.0)
194
- rack (2.2.7)
192
+ racc (1.7.1)
193
+ rack (2.2.8)
195
194
  rack-test (2.1.0)
196
195
  rack (>= 1.3)
197
- rails (7.0.5)
198
- actioncable (= 7.0.5)
199
- actionmailbox (= 7.0.5)
200
- actionmailer (= 7.0.5)
201
- actionpack (= 7.0.5)
202
- actiontext (= 7.0.5)
203
- actionview (= 7.0.5)
204
- activejob (= 7.0.5)
205
- activemodel (= 7.0.5)
206
- activerecord (= 7.0.5)
207
- activestorage (= 7.0.5)
208
- activesupport (= 7.0.5)
196
+ rails (7.0.8)
197
+ actioncable (= 7.0.8)
198
+ actionmailbox (= 7.0.8)
199
+ actionmailer (= 7.0.8)
200
+ actionpack (= 7.0.8)
201
+ actiontext (= 7.0.8)
202
+ actionview (= 7.0.8)
203
+ activejob (= 7.0.8)
204
+ activemodel (= 7.0.8)
205
+ activerecord (= 7.0.8)
206
+ activestorage (= 7.0.8)
207
+ activesupport (= 7.0.8)
209
208
  bundler (>= 1.15.0)
210
- railties (= 7.0.5)
211
- rails-dom-testing (2.0.3)
212
- activesupport (>= 4.2.0)
209
+ railties (= 7.0.8)
210
+ rails-dom-testing (2.2.0)
211
+ activesupport (>= 5.0.0)
212
+ minitest
213
213
  nokogiri (>= 1.6)
214
214
  rails-html-sanitizer (1.6.0)
215
215
  loofah (~> 2.21)
216
216
  nokogiri (~> 1.14)
217
- railties (7.0.5)
218
- actionpack (= 7.0.5)
219
- activesupport (= 7.0.5)
217
+ railties (7.0.8)
218
+ actionpack (= 7.0.8)
219
+ activesupport (= 7.0.8)
220
220
  method_source
221
221
  rake (>= 12.2)
222
222
  thor (~> 1.0)
@@ -227,11 +227,9 @@ GEM
227
227
  rb-inotify (0.10.1)
228
228
  ffi (~> 1.0)
229
229
  rchardet (1.8.0)
230
- redis-client (0.14.1)
231
- connection_pool
232
230
  regexp_parser (2.8.1)
233
231
  retriable (3.1.2)
234
- rexml (3.2.5)
232
+ rexml (3.2.6)
235
233
  rspec (3.12.0)
236
234
  rspec-core (~> 3.12.0)
237
235
  rspec-expectations (~> 3.12.0)
@@ -241,7 +239,7 @@ GEM
241
239
  rspec-expectations (3.12.3)
242
240
  diff-lcs (>= 1.2.0, < 2.0)
243
241
  rspec-support (~> 3.12.0)
244
- rspec-mocks (3.12.5)
242
+ rspec-mocks (3.12.6)
245
243
  diff-lcs (>= 1.2.0, < 2.0)
246
244
  rspec-support (~> 3.12.0)
247
245
  rspec-rails (6.0.3)
@@ -252,73 +250,72 @@ GEM
252
250
  rspec-expectations (~> 3.12)
253
251
  rspec-mocks (~> 3.12)
254
252
  rspec-support (~> 3.12)
255
- rspec-support (3.12.0)
256
- rubocop (1.52.0)
253
+ rspec-support (3.12.1)
254
+ rubocop (1.56.3)
255
+ base64 (~> 0.1.1)
257
256
  json (~> 2.3)
257
+ language_server-protocol (>= 3.17.0)
258
258
  parallel (~> 1.10)
259
- parser (>= 3.2.0.0)
259
+ parser (>= 3.2.2.3)
260
260
  rainbow (>= 2.2.2, < 4.0)
261
261
  regexp_parser (>= 1.8, < 3.0)
262
262
  rexml (>= 3.2.5, < 4.0)
263
- rubocop-ast (>= 1.28.0, < 2.0)
263
+ rubocop-ast (>= 1.28.1, < 2.0)
264
264
  ruby-progressbar (~> 1.7)
265
265
  unicode-display_width (>= 2.4.0, < 3.0)
266
266
  rubocop-ast (1.29.0)
267
267
  parser (>= 3.2.1.0)
268
- rubocop-capybara (2.18.0)
268
+ rubocop-capybara (2.19.0)
269
269
  rubocop (~> 1.41)
270
- rubocop-factory_bot (2.23.1)
270
+ rubocop-factory_bot (2.24.0)
271
271
  rubocop (~> 1.33)
272
- rubocop-performance (1.18.0)
272
+ rubocop-performance (1.19.1)
273
273
  rubocop (>= 1.7.0, < 2.0)
274
274
  rubocop-ast (>= 0.4.0)
275
- rubocop-rails (2.19.1)
275
+ rubocop-rails (2.20.2)
276
276
  activesupport (>= 4.2.0)
277
277
  rack (>= 1.1)
278
278
  rubocop (>= 1.33.0, < 2.0)
279
- rubocop-rspec (2.22.0)
279
+ rubocop-rspec (2.24.1)
280
280
  rubocop (~> 1.33)
281
281
  rubocop-capybara (~> 2.17)
282
282
  rubocop-factory_bot (~> 2.22)
283
- rubocop-vendor (0.11.0)
284
- rubocop (>= 0.53.0)
283
+ rubocop-vendor (0.12.1)
284
+ rubocop
285
285
  ruby-progressbar (1.13.0)
286
286
  shellany (0.0.1)
287
- sidekiq (7.1.2)
288
- concurrent-ruby (< 2)
289
- connection_pool (>= 2.3.0)
290
- rack (>= 2.2.4)
291
- redis-client (>= 0.14.0)
292
- standard (1.29.0)
287
+ standard (1.31.1)
293
288
  language_server-protocol (~> 3.17.0.2)
294
289
  lint_roller (~> 1.0)
295
- rubocop (~> 1.52.0)
290
+ rubocop (~> 1.56.2)
296
291
  standard-custom (~> 1.0.0)
297
- standard-performance (~> 1.1.0)
298
- standard-custom (1.0.1)
299
- lint_roller (~> 1.0)
300
- standard-performance (1.1.0)
292
+ standard-performance (~> 1.2)
293
+ standard-custom (1.0.2)
301
294
  lint_roller (~> 1.0)
302
- rubocop-performance (~> 1.18.0)
303
- standard-rails (0.1.0)
295
+ rubocop (~> 1.50)
296
+ standard-performance (1.2.0)
297
+ lint_roller (~> 1.1)
298
+ rubocop-performance (~> 1.19.0)
299
+ standard-rails (0.2.0)
304
300
  lint_roller (~> 1.0)
305
- rubocop-rails (~> 2.19.0)
301
+ rubocop-rails (~> 2.20.2)
306
302
  thor (1.2.2)
307
- timeout (0.3.2)
303
+ timeout (0.4.0)
308
304
  treetop (1.6.12)
309
305
  polyglot (~> 0.3)
310
306
  tzinfo (2.0.6)
311
307
  concurrent-ruby (~> 1.0)
312
308
  unicode-display_width (2.4.2)
313
- websocket-driver (0.7.5)
309
+ websocket-driver (0.7.6)
314
310
  websocket-extensions (>= 0.1.0)
315
311
  websocket-extensions (0.1.5)
316
- ws-style (7.1.0)
312
+ ws-style (7.2.0)
317
313
  rubocop-rspec (>= 2.2.0)
318
314
  rubocop-vendor (>= 0.11)
319
- standard (>= 1.28.2)
315
+ standard (>= 1.30.1)
316
+ standard-custom (>= 1.0.2)
320
317
  standard-rails (>= 0.1.0)
321
- zeitwerk (2.6.8)
318
+ zeitwerk (2.6.12)
322
319
 
323
320
  PLATFORMS
324
321
  arm64-darwin-22
data/README.md CHANGED
@@ -82,6 +82,19 @@ Setup an initializer in `config/initializers/eventsimple.rb`:
82
82
  end
83
83
  ```
84
84
 
85
+ If using `Sidekiq` as a backend to `ActiveJob` for async reactors, please add this setting to
86
+ `config/application.rb`:
87
+ ```ruby
88
+ config.active_job.queue_adapter = :sidekiq
89
+ ```
90
+ The jobs are pushed into a queue named `eventsimple`, so please add it to your
91
+ `sidekiq.yml` as follows:
92
+ ```yml
93
+ :queues:
94
+ - [default, 10]
95
+ - [eventsimple, 10]
96
+ ```
97
+
85
98
  Generate a migration and add `Eventsimple` to an existing ActiveRecord model.
86
99
 
87
100
  ```ruby
data/eventsimple.gemspec CHANGED
@@ -28,7 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency 'pg', '~> 1.4'
29
29
  spec.add_runtime_dependency 'rails', '~> 7.0'
30
30
  spec.add_runtime_dependency 'retriable', '~> 3.1'
31
- spec.add_runtime_dependency 'sidekiq', '~> 7.0'
32
31
 
33
32
  spec.add_development_dependency 'bundle-audit'
34
33
  spec.add_development_dependency 'fuubar'
@@ -5,12 +5,13 @@ module ActiveJob
5
5
  extend self
6
6
 
7
7
  def deserialize_global_id(hash)
8
+ gid = GlobalID.parse(hash[GLOBALID_KEY])
8
9
  # For non database based processors like sidekiq, the reactor may trigger before the
9
10
  # transaction is committed. Attempt to wait for the transaction to be commited before
10
11
  # running the reactor. This is not a perfect solution, but it's better than nothing.
11
12
  if Eventsimple.configuration.retry_reactor_on_record_not_found
12
13
  Retriable.with_context(:reactor) do
13
- ApplicationRecord.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
14
+ gid.model_class.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
14
15
  end
15
16
  else
16
17
  GlobalID::Locator.locate hash[GLOBALID_KEY]
@@ -6,8 +6,10 @@ module Eventsimple
6
6
  include Sidekiq::Worker
7
7
 
8
8
  def perform(event_global_id, reactor_class)
9
+ gid = GlobalID.parse(event_global_id)
10
+
9
11
  event = Retriable.with_context(:reactor) do
10
- ApplicationRecord.uncached { GlobalID::Locator.locate event_global_id }
12
+ gid.model_class.uncached { GlobalID::Locator.locate event_global_id }
11
13
  end
12
14
  rescue ActiveRecord::RecordNotFound
13
15
  Rails.logger.error("Event #{event_global_id} not found for reactor: #{reactor_class}")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '1.1.2'
4
+ VERSION = '1.2.0'
5
5
  end
data/lib/eventsimple.rb CHANGED
@@ -9,7 +9,6 @@ require 'active_support'
9
9
  require 'dry-types'
10
10
  require 'dry-struct'
11
11
  require 'retriable'
12
- require 'sidekiq'
13
12
 
14
13
  require 'dry_types'
15
14
 
@@ -22,7 +21,6 @@ require 'eventsimple/metadata'
22
21
  require 'eventsimple/dispatcher'
23
22
  require 'eventsimple/event_dispatcher'
24
23
  require 'eventsimple/reactor'
25
- require 'eventsimple/reactor_worker'
26
24
  require 'eventsimple/invalid_transition'
27
25
 
28
26
  require 'eventsimple/entity'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zulfiqar Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.1'
83
- - !ruby/object:Gem::Dependency
84
- name: sidekiq
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '7.0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '7.0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: bundle-audit
99
85
  requirement: !ruby/object:Gem::Requirement