eventsimple 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46f6a80be5a43cb84c321b67e9a27dde596b2eb3aa3d55ce8f635e395f42ce19
4
- data.tar.gz: c3abab5c2bd25bee61695d24cdb9104cd11d403bb2b360ad1417f71f3006cd54
3
+ metadata.gz: 989aab149125d77a97510193a1905233eef5714a798a821e14fa7697247b5403
4
+ data.tar.gz: 7dc3276c03f6ab9617733ef292297ba2e5dc9b414c5d221621b2bed5a8635151
5
5
  SHA512:
6
- metadata.gz: 3eb05c140311c7466f6cc27fe2a63e033f4464123449d9c9bc20b4b3ae9dd207b03bfe3acfd00cbf6c04bfa4c55456910fb2cee80056e04b5ec5aff70a4b73c1
7
- data.tar.gz: fe56e5c4b5fa1608bd05a01f2b05f2051c8d7491170dc0c06790279a134a5d2b19465feca5104420d7dc43dcf2816e982d7aafbaa0aa65bfeadcca0ad476948d
6
+ metadata.gz: a378b62e0dc1e50540b85f002b06d5a8ff8b17d338b9b7a860d97f630538c919dde28bd1ff44c1d0ef62e29044e26f11089115e03bbd08545c60566fd893a9c5
7
+ data.tar.gz: 34cd12770a08ff80b4c6e7ee6e01e0c8e347415d7303ee646d4328a734ca2214180cd64e223e38fe7bae1bb6f39a702aa44ad2dc9e440677cd42e3ce1424618b
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## Unreleased
8
8
 
9
+ ## 1.1.2 - 2023-06-22
10
+ ### Changed
11
+ - Fix exception noise generated by early global_id desrialization
12
+
9
13
  ## 1.1.1 - 2023-06-19
10
14
  ### Changed
11
15
  - Remove active_job_parent_klass config introduced in 1.1.0. There isn't a usecase for it yet,
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- eventsimple (1.1.1)
4
+ eventsimple (1.1.2)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  pg (~> 1.4)
@@ -0,0 +1,20 @@
1
+ require 'active_job/arguments'
2
+
3
+ module ActiveJob
4
+ module Arguments
5
+ extend self
6
+
7
+ def deserialize_global_id(hash)
8
+ # For non database based processors like sidekiq, the reactor may trigger before the
9
+ # transaction is committed. Attempt to wait for the transaction to be commited before
10
+ # running the reactor. This is not a perfect solution, but it's better than nothing.
11
+ if Eventsimple.configuration.retry_reactor_on_record_not_found
12
+ Retriable.with_context(:reactor) do
13
+ ApplicationRecord.uncached { GlobalID::Locator.locate hash[GLOBALID_KEY] }
14
+ end
15
+ else
16
+ GlobalID::Locator.locate hash[GLOBALID_KEY]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -4,29 +4,12 @@ module Eventsimple
4
4
  class Reactor < ActiveJob::Base # rubocop:disable Rails/ApplicationJob
5
5
  queue_as :eventsimple
6
6
 
7
- def perform(event)
8
- call(event)
7
+ discard_on ActiveJob::DeserializationError do |job, error|
8
+ Rails.logger.warn("Event #{job.arguments.first} not found for reactor: #{self.class}")
9
9
  end
10
10
 
11
- around_perform do |job, block|
12
- event_global_id = job.arguments.first
13
- reactor_class = job.arguments.second
14
-
15
- # For non database based processors like sidekiq, the reactor may trigger before the
16
- # transaction is committed. Attempt to wait for the transaction to be commited before
17
- # running the reactor. This is not a perfect solution, but it's better than nothing.
18
- if Eventsimple.configuration.retry_reactor_on_record_not_found
19
- begin
20
- Retriable.with_context(:reactor) do
21
- ApplicationRecord.uncached { GlobalID::Locator.locate(event_global_id) }
22
- end
23
- rescue ActiveRecord::RecordNotFound
24
- Rails.logger.error("Event #{event_global_id} not found for reactor: #{reactor_class}")
25
- return
26
- end
27
- end
28
-
29
- block.call
11
+ def perform(event)
12
+ call(event)
30
13
  end
31
14
  end
32
15
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Eventsimple
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
  end
data/lib/eventsimple.rb CHANGED
@@ -13,6 +13,7 @@ require 'sidekiq'
13
13
 
14
14
  require 'dry_types'
15
15
 
16
+ require 'eventsimple/active_job/arguments'
16
17
  require 'eventsimple/configuration'
17
18
  require 'eventsimple/message'
18
19
  require 'eventsimple/data_type'
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.1
4
+ version: 1.1.2
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-19 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -253,6 +253,7 @@ files:
253
253
  - eventsimple.gemspec
254
254
  - lib/dry_types.rb
255
255
  - lib/eventsimple.rb
256
+ - lib/eventsimple/active_job/arguments.rb
256
257
  - lib/eventsimple/configuration.rb
257
258
  - lib/eventsimple/data_type.rb
258
259
  - lib/eventsimple/dispatcher.rb