pgmq-ruby 0.6.0 → 0.6.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 +6 -0
- data/lib/pgmq/connection.rb +21 -9
- 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: c2a31db1ba5a65a0666bb496ae5b54e0a51de5cafe9b92ebf55b432ea309ef44
|
|
4
|
+
data.tar.gz: cbf292400bff6ca3f34bdb95ff8a7c6910df5da4db3cbabc574c7b3173864523
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 687e92a06cb6fd93f2015390153693fb267faebc7b4bc8c54fd547cfda2ec87a1621e2be47bb9f2ac70c40b1394a854daee85c4d069845b3756c980672fc49c0
|
|
7
|
+
data.tar.gz: cb4c6c32f6d69e6329dd12fba2e319865087b08994e894ce169e3360595bc59fb425c6b432ca2ee040b13c4367f0b20ccf307f6fadf9b4d9619dbfc3a509f0a4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.1 (2026-04-16)
|
|
4
|
+
|
|
5
|
+
### Connection Management
|
|
6
|
+
- **[Fix]** `PGMQ::Connection#verify_connection!` now also resets connections whose status is `PG::CONNECTION_BAD`. Previously it only checked `conn.finished?`, which misses connections closed server-side by the database or an intermediate pooler (PgBouncer `server_idle_timeout` / `client_idle_timeout`, admin kill, TCP RST). A pooled connection with a dead socket would survive `verify_connection!` and fail on the next operation with `PQsocket() can't get socket descriptor`.
|
|
7
|
+
- **[Fix]** `PGMQ::Connection#connection_lost_error?` now recognises `"PQsocket() can't get socket descriptor"` (plus `"connection is closed"` / `"connection has been closed"`). This is the exact error the `pg` gem raises from its C extension when the cached libpq socket FD is gone. Without the match, the `auto_reconnect` retry path in `with_connection` skipped this error and producers failed on the first call following a server-side close.
|
|
8
|
+
|
|
3
9
|
## 0.6.0 (2026-04-02)
|
|
4
10
|
|
|
5
11
|
### Breaking Changes
|
data/lib/pgmq/connection.rb
CHANGED
|
@@ -111,29 +111,41 @@ module PGMQ
|
|
|
111
111
|
# @param error [PG::Error] the error to check
|
|
112
112
|
# @return [Boolean] true if connection was lost
|
|
113
113
|
def connection_lost_error?(error)
|
|
114
|
-
# Common connection lost errors
|
|
114
|
+
# Common connection lost errors. Include the pg-gem C-extension message
|
|
115
|
+
# ("PQsocket() can't get socket descriptor") that is raised when the
|
|
116
|
+
# cached libpq socket descriptor is gone — e.g. after a server-side
|
|
117
|
+
# close by a connection pooler such as PgBouncer.
|
|
115
118
|
lost_connection_messages = [
|
|
116
119
|
"server closed the connection",
|
|
117
120
|
"connection not open",
|
|
121
|
+
"connection is closed",
|
|
122
|
+
"connection has been closed",
|
|
118
123
|
"no connection to the server",
|
|
119
124
|
"terminating connection",
|
|
120
125
|
"connection to server was lost",
|
|
121
|
-
"could not receive data from server"
|
|
126
|
+
"could not receive data from server",
|
|
127
|
+
"pqsocket() can't get socket descriptor"
|
|
122
128
|
]
|
|
123
129
|
|
|
124
|
-
message = error.message.downcase
|
|
130
|
+
message = error.message.to_s.downcase
|
|
125
131
|
lost_connection_messages.any? { |pattern| message.include?(pattern) }
|
|
126
132
|
end
|
|
127
133
|
|
|
128
|
-
# Verifies a connection is alive and working
|
|
134
|
+
# Verifies a connection is alive and working.
|
|
135
|
+
#
|
|
136
|
+
# Also resets when the connection reports `PG::CONNECTION_BAD`, which
|
|
137
|
+
# happens when the server (or an intermediate pooler such as PgBouncer)
|
|
138
|
+
# has closed the socket while the client-side `PG::Connection` object
|
|
139
|
+
# still exists. `#finished?` alone only catches connections closed
|
|
140
|
+
# explicitly from the client side.
|
|
141
|
+
#
|
|
129
142
|
# @param conn [PG::Connection] connection to verify
|
|
130
|
-
# @raise [PG::Error] if
|
|
143
|
+
# @raise [PG::Error] if the reset itself fails
|
|
131
144
|
def verify_connection!(conn)
|
|
132
|
-
|
|
133
|
-
return
|
|
145
|
+
return conn.reset if conn.finished?
|
|
146
|
+
return conn.reset if conn.status == PG::CONNECTION_BAD
|
|
134
147
|
|
|
135
|
-
|
|
136
|
-
conn.reset
|
|
148
|
+
nil
|
|
137
149
|
end
|
|
138
150
|
|
|
139
151
|
# Normalizes various connection parameter formats
|
data/lib/pgmq/version.rb
CHANGED