pub_sub_model_sync 1.2.0 → 1.2.1

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: ec006984fe2bf9c33e9992facdd25aa9fdaa3494b6bcaf656592593829429017
4
- data.tar.gz: 8ca60de929eb7465c95ff819682af73a9094c60294661e5c823394aeb02ed6a9
3
+ metadata.gz: 86dd60cd72d095630d44b3d1d6bb0004f0d7ce35326f5613127815047376530a
4
+ data.tar.gz: ef7c8edd08a315adcbad4a4314a467e1564a8dcc2233764ef53d09985a41eaf3
5
5
  SHA512:
6
- metadata.gz: d799e1e27c071e18d5d7e15460a7d481b9991b469599356e23c86669fd8de95046b236d4596a5fbc22e93d278548d2b17255262e4f5c67eece7a4f6898ff03ca
7
- data.tar.gz: 89f6e95f040919994a0f0397b61b09ac83567b69472ce41aa722b240dba66e8a66d4e7a60cedb0de5f59d671525c4d7ad38b02255e558728f8e34e71e227e1e1
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: include `ordering_key topic_name` when delivering a notification for debugging purposes
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pub_sub_model_sync (1.2.0)
4
+ pub_sub_model_sync (1.2.1)
5
5
  rails
6
6
 
7
7
  GEM
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?
@@ -77,7 +77,7 @@ module PubSubModelSync
77
77
  }.merge(PUBLISH_SETTINGS)
78
78
  end
79
79
 
80
- # @return [Subscriber]
80
+ # @return [Array<Subscriber>]
81
81
  def subscribe_to_topics
82
82
  topics.map do |key, topic|
83
83
  subs_name = "#{config.subscription_key}_#{key}"
@@ -19,10 +19,11 @@ module PubSubModelSync
19
19
  # @param payload (Payload)
20
20
  def add_payload(payload)
21
21
  payloads << payload
22
- log("Payload added to current transaction: #{payload.inspect}") if config.debug
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 do |payload|
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PubSubModelSync
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pub_sub_model_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Owen