pgmq-ruby 0.8.0 → 0.8.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 +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +1 -1
- data/lib/pgmq/client/producer.rb +6 -6
- data/lib/pgmq/client/topics.rb +5 -5
- data/lib/pgmq/client.rb +7 -1
- data/lib/pgmq/connection.rb +1 -1
- data/lib/pgmq/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: f66e00ebdfb72d1bdf92956a632bb22e0ca4f36a5dc262c3e3e206a3e35884cc
|
|
4
|
+
data.tar.gz: 93d9c3f674990f774581c70fb9c59d2f5c7920d617f9dcf9ad9c051efb7e661b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 131525c92fceebbbf80964b98168bd4343fccb221eea5a13c55d6cf0f84a168641e09f3a686d5ef35ecc6854e8b6a8f9577d2a5e7553423bd4c44ba41df09f3c
|
|
7
|
+
data.tar.gz: b851ab706d9986c718855577e3eaebd8e3c79562aabf67943bdb7573427847a9392f5385dfb399edb642c1e2a663028adecbb7bfa6790964ea684d54125e1b02
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.1 (2026-10-30)
|
|
4
|
+
|
|
5
|
+
### Producer
|
|
6
|
+
- **[Fix]** A whole-second `ActiveSupport::Duration` delay (`delay: 5.minutes`) works again in `produce`, `produce_batch`
|
|
7
|
+
and `produce_batch_topic`; 0.8.0 raised `NoMethodError: undefined method 'to_time'`. A fractional one
|
|
8
|
+
(`delay: 1.5.seconds`) now works in all four producers, `produce_topic` included, and stays fractional. A Duration is
|
|
9
|
+
bound as its number of seconds.
|
|
10
|
+
|
|
11
|
+
### Testing
|
|
12
|
+
- **[Feature]** `bin/integrations` runs a spec in a `*_pristine` directory in its own bundle from that directory's
|
|
13
|
+
`Gemfile`. The ActiveSupport delay spec uses it to test with real activesupport, which the main Gemfile does not
|
|
14
|
+
have.
|
|
15
|
+
|
|
3
16
|
## 0.8.0 (2026-10-25)
|
|
4
17
|
|
|
5
18
|
### Consumer
|
data/README.md
CHANGED
|
@@ -357,7 +357,7 @@ PGMQ::Connection.reconnectable_error_patterns = [
|
|
|
357
357
|
]
|
|
358
358
|
|
|
359
359
|
# Any Exception subclass is accepted. Subclasses also match.
|
|
360
|
-
PGMQ::Connection.reconnectable_error_classes = [PG::
|
|
360
|
+
PGMQ::Connection.reconnectable_error_classes = [PG::ConnectionFailure]
|
|
361
361
|
```
|
|
362
362
|
|
|
363
363
|
The built-in defaults are always kept - your patterns and classes are
|
data/lib/pgmq/client/producer.rb
CHANGED
|
@@ -12,9 +12,9 @@ module PGMQ
|
|
|
12
12
|
# @param queue_name [String] name of the queue
|
|
13
13
|
# @param message [String] message as JSON string (for PostgreSQL JSONB)
|
|
14
14
|
# @param headers [String, nil] optional headers as JSON string (for metadata, routing, tracing)
|
|
15
|
-
# @param delay [Numeric, Time] delay in seconds before message becomes visible (integer
|
|
16
|
-
# a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the message
|
|
17
|
-
# including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
15
|
+
# @param delay [Numeric, ActiveSupport::Duration, Time] delay in seconds before message becomes visible (integer,
|
|
16
|
+
# float or Duration; a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the message
|
|
17
|
+
# becomes visible, including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
18
18
|
# @return [String] message ID as string
|
|
19
19
|
# @raise [PGMQ::Errors::MessageInvalidError] if message is not a String, or headers is neither a String nor
|
|
20
20
|
# nil
|
|
@@ -71,9 +71,9 @@ module PGMQ
|
|
|
71
71
|
# @param queue_name [String] name of the queue
|
|
72
72
|
# @param messages [Array<String>] array of message payloads as JSON strings
|
|
73
73
|
# @param headers [Array<String>, nil] optional array of headers as JSON strings (must match messages length)
|
|
74
|
-
# @param delay [Numeric, Time] delay in seconds before messages become visible (integer
|
|
75
|
-
# a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the messages
|
|
76
|
-
# including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
74
|
+
# @param delay [Numeric, ActiveSupport::Duration, Time] delay in seconds before messages become visible (integer,
|
|
75
|
+
# float or Duration; a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the messages
|
|
76
|
+
# become visible, including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
77
77
|
# @return [Array<String>] array of message IDs
|
|
78
78
|
# @raise [PGMQ::Errors::MessageInvalidError] if messages is not an Array, headers is neither an Array nor nil,
|
|
79
79
|
# headers length doesn't match messages length, a message is not a String, or a header is neither a String
|
data/lib/pgmq/client/topics.rb
CHANGED
|
@@ -70,8 +70,8 @@ module PGMQ
|
|
|
70
70
|
# @param routing_key [String] dot-separated routing key (e.g., "orders.new.priority")
|
|
71
71
|
# @param message [String] message as JSON string
|
|
72
72
|
# @param headers [String, nil] optional headers as JSON string
|
|
73
|
-
# @param delay [Numeric] delay in seconds before message becomes visible (integer
|
|
74
|
-
# 1.5 needs PGMQ v1.10.0+)
|
|
73
|
+
# @param delay [Numeric, ActiveSupport::Duration] delay in seconds before message becomes visible (integer,
|
|
74
|
+
# float or Duration; a float such as 1.5 needs PGMQ v1.10.0+)
|
|
75
75
|
# @return [Integer] count of queues the message was delivered to
|
|
76
76
|
#
|
|
77
77
|
# @example Basic topic send
|
|
@@ -117,9 +117,9 @@ module PGMQ
|
|
|
117
117
|
# @param routing_key [String] dot-separated routing key
|
|
118
118
|
# @param messages [Array<String>] array of message payloads as JSON strings
|
|
119
119
|
# @param headers [Array<String>, nil] optional array of headers as JSON strings
|
|
120
|
-
# @param delay [Numeric, Time] delay in seconds before messages become visible (integer
|
|
121
|
-
# a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the messages
|
|
122
|
-
# including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
120
|
+
# @param delay [Numeric, ActiveSupport::Duration, Time] delay in seconds before messages become visible (integer,
|
|
121
|
+
# float or Duration; a float such as 1.5 needs PGMQ v1.10.0+), or an absolute Time at which the messages
|
|
122
|
+
# become visible, including ActiveSupport::TimeWithZone (PGMQ v1.10.0+)
|
|
123
123
|
# @return [Array<Hash>] array of hashes with :queue_name and :msg_id
|
|
124
124
|
# @raise [PGMQ::Errors::MessageInvalidError] if messages is not an Array, headers is neither an Array nor nil,
|
|
125
125
|
# or headers length doesn't match messages length
|
data/lib/pgmq/client.rb
CHANGED
|
@@ -179,7 +179,11 @@ module PGMQ
|
|
|
179
179
|
# +timestamptz+ overload as +clock_timestamp()+ plus the delay. This is how PGMQ itself turns an integer delay
|
|
180
180
|
# into a visibility time, so the database clock is used in both cases.
|
|
181
181
|
#
|
|
182
|
-
#
|
|
182
|
+
# +ActiveSupport::Duration+ (+5.minutes+) answers +is_a?+ for its value but is not a Numeric, so
|
|
183
|
+
# +Integer === 5.minutes+ is false and it reaches the last branch. It is converted there to a plain number, which
|
|
184
|
+
# keeps the +is_a?+ calls off the path of a plain Integer or Float.
|
|
185
|
+
#
|
|
186
|
+
# @param delay [Numeric, ActiveSupport::Duration, Time] delay in seconds or an absolute Time
|
|
183
187
|
# @param index [Integer] position of the delay bind parameter in the query
|
|
184
188
|
# @return [Array(String, Object)] SQL argument and its bind value
|
|
185
189
|
def delay_argument(delay, index)
|
|
@@ -189,6 +193,8 @@ module PGMQ
|
|
|
189
193
|
when Numeric
|
|
190
194
|
["clock_timestamp() + make_interval(secs => $#{index}::double precision)", delay.to_f]
|
|
191
195
|
else
|
|
196
|
+
return delay_argument(delay.is_a?(Integer) ? delay.to_i : delay.to_f, index) if delay.is_a?(Numeric)
|
|
197
|
+
|
|
192
198
|
["$#{index}::timestamptz", delay.to_time.utc.iso8601(6)]
|
|
193
199
|
end
|
|
194
200
|
end
|
data/lib/pgmq/connection.rb
CHANGED
|
@@ -53,7 +53,7 @@ module PGMQ
|
|
|
53
53
|
#
|
|
54
54
|
# @return [Array<Class>]
|
|
55
55
|
# @example
|
|
56
|
-
# PGMQ::Connection.reconnectable_error_classes = [PG::
|
|
56
|
+
# PGMQ::Connection.reconnectable_error_classes = [PG::ConnectionFailure]
|
|
57
57
|
attr_reader :reconnectable_error_classes
|
|
58
58
|
|
|
59
59
|
# Replaces the extra reconnectable error patterns.
|
data/lib/pgmq/version.rb
CHANGED