pub_sub_model_sync 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/pub_sub_model_sync/service_google.rb +1 -1
- data/lib/pub_sub_model_sync/transaction.rb +10 -9
- data/lib/pub_sub_model_sync/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86dd60cd72d095630d44b3d1d6bb0004f0d7ce35326f5613127815047376530a
|
4
|
+
data.tar.gz: ef7c8edd08a315adcbad4a4314a467e1564a8dcc2233764ef53d09985a41eaf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 690ca42fe8d463cabdaa4e0e557ee1fa19ffa0e1c9a4ad19ee1a1195a7a78faab458ebcd0b0581c39b917ac73c9dc01f408bf1c9ae7f25445b7d20afba2592fe
|
7
|
+
data.tar.gz: 72d3e0a10a8879f670e65a6f50dbc71e0351893ac1b57dc6fe1796373f7a38d55ecc7a6508c86eba7256dab03c903a42b59f9a0b7a881f6c4c28086b59584049
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
# 1.2.1 (October 28, 2021)
|
4
|
+
chore: improve logs
|
5
|
+
|
3
6
|
# 1.2.0 (October 28, 2021)
|
4
7
|
- feat: rename Payload `:key` into `:internal_key` to avoid confusions while debugging
|
5
8
|
|
6
9
|
# 1.1.1 (October 25, 2021)
|
7
|
-
- feat:
|
10
|
+
- feat: do not exclude `ordering_key topic_name` when delivering a notification (required when debugging)
|
8
11
|
- doc: improve docs
|
9
12
|
|
10
13
|
# 1.1.0 (October 25, 2021)
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -557,6 +557,7 @@ config.debug = true
|
|
557
557
|
Note2: Only notifications from the buffer can be rollbacked if the current transaction has failed.
|
558
558
|
|
559
559
|
## **TODO**
|
560
|
+
- add the ability to raise SKIP_ACKNOWLEDGE to auto retry by PubSub
|
560
561
|
- Auto publish update only if payload has changed (see ways to compare previous payload vs new payload)
|
561
562
|
- Improve transactions to exclude similar notifications by klass and action. Sample:
|
562
563
|
```PubSubModelSync::MessagePublisher.transaction(key, { same_keys: :use_last_as_first|:use_last|:use_first_as_last|:keep*, same_data: :use_last_as_first*|:use_last|:use_first_as_last|:keep })```
|
@@ -568,6 +569,7 @@ config.debug = true
|
|
568
569
|
- Add if/unless to ps_after_action
|
569
570
|
- Add subscription liveness checker using thread without db connection to check periodically pending notifications from google pubsub
|
570
571
|
- Unify .stop() and 'Listener stopped'
|
572
|
+
- TODO: Publish new version 1.2.1 (improve logs)
|
571
573
|
|
572
574
|
## **Q&A**
|
573
575
|
- I'm getting error "could not obtain a connection from the pool within 5.000 seconds"... what does this mean?
|
@@ -19,10 +19,11 @@ module PubSubModelSync
|
|
19
19
|
# @param payload (Payload)
|
20
20
|
def add_payload(payload)
|
21
21
|
payloads << payload
|
22
|
-
|
22
|
+
print_log = config.debug && max_buffer > 1
|
23
|
+
log("Payload added to current transaction: #{payload.inspect}") if print_log
|
23
24
|
return unless payloads.count >= max_buffer
|
24
25
|
|
25
|
-
log("Payloads buffer was filled, delivering current payloads: #{payloads.count}")
|
26
|
+
log("Payloads buffer was filled, delivering current payloads: #{payloads.count}") if print_log
|
26
27
|
deliver_payloads
|
27
28
|
end
|
28
29
|
|
@@ -60,14 +61,14 @@ module PubSubModelSync
|
|
60
61
|
private
|
61
62
|
|
62
63
|
def deliver_payloads
|
63
|
-
payloads.each
|
64
|
-
begin # rubocop:disable Style/RedundantBegin (ruby 2.4 support)
|
65
|
-
PUBLISHER_KLASS.connector_publish(payload)
|
66
|
-
rescue => e
|
67
|
-
PUBLISHER_KLASS.send(:notify_error, e, payload)
|
68
|
-
end
|
69
|
-
end
|
64
|
+
payloads.each(&method(:deliver_payload))
|
70
65
|
self.payloads = []
|
71
66
|
end
|
67
|
+
|
68
|
+
def deliver_payload(payload)
|
69
|
+
PUBLISHER_KLASS.connector_publish(payload)
|
70
|
+
rescue => e
|
71
|
+
PUBLISHER_KLASS.send(:notify_error, e, payload)
|
72
|
+
end
|
72
73
|
end
|
73
74
|
end
|