pub_sub_model_sync 1.6.1pre → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/README.md +1 -1
- data/lib/pub_sub_model_sync/message_processor.rb +10 -9
- data/lib/pub_sub_model_sync/version.rb +1 -1
- 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: 0e26ccd6c9b5cbcc0809a9f69e98e29d28de26b5f6b8e1fd8ccd26605f86a545
|
4
|
+
data.tar.gz: '08d8a2f7bb38d98c962537859fd5ec6ffb69810fcbdee0e35fc6a9495efe9bce'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53727bf22d98289607eb3261f1687709451ca6d14c7047f1f2a6dc52088789fc2f8b806528126aec8165c46af45aa19b2bbbb4ac5586984d663e192a83532df6
|
7
|
+
data.tar.gz: 98c8a4ec4948f68296eea8730671c766ee55657ebbb580b3642c059632d090ced160a05ce3b105709645435b6ce816a88d5465935bd4f31339c3cb2870297a62
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pub_sub_model_sync (1.6.
|
4
|
+
pub_sub_model_sync (1.6.1)
|
5
5
|
rails
|
6
6
|
|
7
7
|
GEM
|
@@ -99,8 +99,8 @@ GEM
|
|
99
99
|
googleapis-common-protos-types (>= 1.0.6, < 2.0)
|
100
100
|
googleauth (~> 0.15, >= 0.15.1)
|
101
101
|
grpc (~> 1.36)
|
102
|
-
globalid (
|
103
|
-
activesupport (>=
|
102
|
+
globalid (0.4.2)
|
103
|
+
activesupport (>= 4.2.0)
|
104
104
|
google-cloud-core (1.6.0)
|
105
105
|
google-cloud-env (~> 1.0)
|
106
106
|
google-cloud-errors (~> 1.0)
|
@@ -143,12 +143,12 @@ GEM
|
|
143
143
|
i18n (1.8.10)
|
144
144
|
concurrent-ruby (~> 1.0)
|
145
145
|
jwt (2.2.3)
|
146
|
-
loofah (2.
|
146
|
+
loofah (2.9.1)
|
147
147
|
crass (~> 1.0.2)
|
148
148
|
nokogiri (>= 1.5.9)
|
149
149
|
mail (2.7.1)
|
150
150
|
mini_mime (>= 0.1.1)
|
151
|
-
marcel (1.0.
|
151
|
+
marcel (1.0.1)
|
152
152
|
memoist (0.16.2)
|
153
153
|
method_source (1.0.0)
|
154
154
|
mini_mime (1.0.3)
|
@@ -156,7 +156,7 @@ GEM
|
|
156
156
|
multi_json (1.15.0)
|
157
157
|
multipart-post (2.1.1)
|
158
158
|
nio4r (2.5.8)
|
159
|
-
nokogiri (1.
|
159
|
+
nokogiri (1.13.4-x86_64-darwin)
|
160
160
|
racc (~> 1.4)
|
161
161
|
os (1.1.1)
|
162
162
|
parallel (1.20.1)
|
@@ -185,7 +185,7 @@ GEM
|
|
185
185
|
rails-dom-testing (2.0.3)
|
186
186
|
activesupport (>= 4.2.0)
|
187
187
|
nokogiri (>= 1.6)
|
188
|
-
rails-html-sanitizer (1.
|
188
|
+
rails-html-sanitizer (1.3.0)
|
189
189
|
loofah (~> 2.3)
|
190
190
|
railties (6.1.3.2)
|
191
191
|
actionpack (= 6.1.3.2)
|
@@ -230,19 +230,19 @@ GEM
|
|
230
230
|
faraday (>= 0.17.3, < 2.0)
|
231
231
|
jwt (>= 1.5, < 3.0)
|
232
232
|
multi_json (~> 1.10)
|
233
|
-
sprockets (4.0.
|
233
|
+
sprockets (4.0.2)
|
234
234
|
concurrent-ruby (~> 1.0)
|
235
235
|
rack (> 1, < 3)
|
236
|
-
sprockets-rails (3.
|
237
|
-
actionpack (>=
|
238
|
-
activesupport (>=
|
236
|
+
sprockets-rails (3.2.2)
|
237
|
+
actionpack (>= 4.0)
|
238
|
+
activesupport (>= 4.0)
|
239
239
|
sprockets (>= 3.0.0)
|
240
240
|
sqlite3 (1.4.2)
|
241
|
-
thor (1.
|
241
|
+
thor (1.1.0)
|
242
242
|
tzinfo (2.0.4)
|
243
243
|
concurrent-ruby (~> 1.0)
|
244
244
|
unicode-display_width (1.7.0)
|
245
|
-
websocket-driver (0.7.
|
245
|
+
websocket-driver (0.7.3)
|
246
246
|
websocket-extensions (>= 0.1.0)
|
247
247
|
websocket-extensions (0.1.5)
|
248
248
|
zeitwerk (2.4.2)
|
data/README.md
CHANGED
@@ -380,7 +380,7 @@ Note: To reduce Payload size, some header info are not delivered (Enable debug m
|
|
380
380
|
**Note**: When any error is raised when saving user or posts, the transaction is cancelled and thus all notifications wont be delivered (customizable by `PubSubModelSync::Config.transactions_use_buffer`).
|
381
381
|
|
382
382
|
- Manual transactions
|
383
|
-
`PubSubModelSync::MessagePublisher::transaction(key,
|
383
|
+
`PubSubModelSync::MessagePublisher::transaction(key, headers: { target_app_key: 'my_other_app_key' } &block)`
|
384
384
|
- `key` (String|nil) Key used as the ordering_key for all inner notifications (When nil, will use `ordering_key` of the first notification)
|
385
385
|
- `max_buffer:` (Integer, default: `PubSubModelSync::Config.transactions_max_buffer`) Transaction buffer size (DEPRECATED).
|
386
386
|
- `headers:` (Hash) Header settings to be added to each Payload's header inside this transaction
|
@@ -20,12 +20,13 @@ module PubSubModelSync
|
|
20
20
|
payload_info = { klass: payload.klass, action: payload.action, mode: payload.mode }
|
21
21
|
log("No subscribers found for #{payload_info}", :warn) if config.debug && subscribers.empty?
|
22
22
|
subscribers.each(&method(:run_subscriber))
|
23
|
+
rescue => e
|
24
|
+
notify_error(e)
|
25
|
+
raise
|
23
26
|
end
|
24
27
|
|
25
28
|
def process
|
26
|
-
process!
|
27
|
-
rescue => e
|
28
|
-
notify_error(e)
|
29
|
+
process! rescue nil # rubocop:disable Style/RescueModifier
|
29
30
|
end
|
30
31
|
|
31
32
|
private
|
@@ -40,9 +41,7 @@ module PubSubModelSync
|
|
40
41
|
res = config.on_success_processing.call(payload, { subscriber: subscriber })
|
41
42
|
log "processed message with: #{payload.inspect}" if res != :skip_log
|
42
43
|
rescue => e
|
43
|
-
|
44
|
-
log("failed processing sync: #{{ klass: e.class.name, msg: e.message, retries: retries, rr: rr, payload: payload }.inspect}", :error)
|
45
|
-
rr ? retry : raise(e)
|
44
|
+
retry_process?(e, retries += 1) ? retry : raise(e)
|
46
45
|
end
|
47
46
|
|
48
47
|
def processable?(subscriber)
|
@@ -58,15 +57,17 @@ module PubSubModelSync
|
|
58
57
|
res = config.on_error_processing.call(error, { payload: payload })
|
59
58
|
log("#{error_msg} #{error_details}", :error) if res != :skip_log
|
60
59
|
rescue => e
|
61
|
-
error_details = [payload, e.message, e.backtrace]
|
62
60
|
log("#{error_msg} #{error_details}", :error)
|
63
61
|
raise(e)
|
64
62
|
end
|
65
63
|
|
66
64
|
# @param error [StandardError]
|
67
65
|
def lost_db_connection?(error)
|
68
|
-
classes = %w[ActiveRecord::ConnectionTimeoutError PG::
|
69
|
-
classes.include?(error.class.name) ||
|
66
|
+
classes = %w[ActiveRecord::ConnectionTimeoutError PG::Error ActiveRecord::ConnectionNotEstablished]
|
67
|
+
classes.include?(error.class.name) ||
|
68
|
+
error.message.match?(/Lost connection to MySQL server/i) ||
|
69
|
+
error.message.start_with?('PG::ConnectionBad:') ||
|
70
|
+
error.message.start_with?('PG::UnableToSend:')
|
70
71
|
end
|
71
72
|
|
72
73
|
def retry_process?(error, retries) # rubocop:disable Metrics/MethodLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pub_sub_model_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -156,9 +156,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '2.4'
|
157
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- - "
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version:
|
161
|
+
version: '0'
|
162
162
|
requirements: []
|
163
163
|
rubygems_version: 3.0.8
|
164
164
|
signing_key:
|