Open
Conversation
Bumps [sequel](https://github.com/jeremyevans/sequel) from 5.101.0 to 5.102.0. - [Changelog](https://github.com/jeremyevans/sequel/blob/master/CHANGELOG) - [Commits](jeremyevans/sequel@5.101.0...5.102.0) --- updated-dependencies: - dependency-name: sequel dependency-version: 5.102.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Contributor
4 similar comments
Contributor
Contributor
Contributor
Contributor
Contributor
gem compare sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT version:
5.101.0: 5.101.0
5.102.0: 5.102.0
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb +151/-0
* Changed:
lib/sequel/connection_pool.rb +6/-0
lib/sequel/connection_pool/sharded_timed_queue.rb +23/-4
lib/sequel/connection_pool/timed_queue.rb +16/-3
lib/sequel/extensions/connection_expiration.rb +1/-1
lib/sequel/extensions/connection_validator.rb +1/-1
lib/sequel/version.rb +1/-1 |
2 similar comments
Contributor
gem compare sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT version:
5.101.0: 5.101.0
5.102.0: 5.102.0
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb +151/-0
* Changed:
lib/sequel/connection_pool.rb +6/-0
lib/sequel/connection_pool/sharded_timed_queue.rb +23/-4
lib/sequel/connection_pool/timed_queue.rb +16/-3
lib/sequel/extensions/connection_expiration.rb +1/-1
lib/sequel/extensions/connection_validator.rb +1/-1
lib/sequel/version.rb +1/-1 |
Contributor
gem compare sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT version:
5.101.0: 5.101.0
5.102.0: 5.102.0
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb +151/-0
* Changed:
lib/sequel/connection_pool.rb +6/-0
lib/sequel/connection_pool/sharded_timed_queue.rb +23/-4
lib/sequel/connection_pool/timed_queue.rb +16/-3
lib/sequel/extensions/connection_expiration.rb +1/-1
lib/sequel/extensions/connection_validator.rb +1/-1
lib/sequel/version.rb +1/-1 |
Contributor
gem compare --diff sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb
--- /tmp/20260302-1549-vct4jz 2026-03-02 03:33:10.335001597 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/extensions/connection_checkout_event_callback.rb 2026-03-02 03:33:10.302001449 +0000
@@ -0,0 +1,151 @@
+# frozen-string-literal: true
+#
+# The connection_checkout_event_callback extension modifies a database's
+# connection pool to allow for a checkout event callback. This callback is
+# called with the following arguments:
+#
+# :immediately_available :: Connection immediately available and returned
+# :not_immediately_available :: Connection not immediately available
+# :new_connection :: New connection created and returned
+# Float :: Number of seconds waiting to acquire a connection
+#
+# This is a low-level extension that allows for building telemetry
+# information. It doesn't implement any telemetry reporting itself. The
+# main reason for recording this information is to use it to determine the
+# appropriate size for the connection pool. Having too large a connection
+# pool can waste resources, while having too small a connection pool can
+# result in substantial time to check out a connection. In general, you
+# want to use as small a pool as possible while keeping the time to
+# checkout a connection low.
+#
+# To use the connection checkout event callback, you must first load the
+# extension:
+#
+# DB.extension(:connection_checkout_event_callback)
+#
+# By default, an empty proc is used as the callback so that loading the
+# support doesn't break anything. If you are using the extension, you
+# should set the callback at some point during application startup:
+#
+# DB.pool.on_checkout_event = proc do |event|
+# # ...
+# end
+#
+# When using the sharded connection pool, the callback is also
+# passed a second argument, the requested server shard (generally a
+# symbol), allowing for collection of per-shard telemetry:
+#
+# DB.pool.on_checkout_event = proc do |event, server|
+# # ...
+# end
+#
+# Note that the callback may be called currently by multiple threads.
+# You should use some form of concurrency control inside the callback,
+# such as a mutex or queue.
+#
+# Below is a brief example of usage to determine the percentage of
+# connection requests where a connection was immediately available:
+#
+# mutex = Mutex.new
+# total = immediates = 0
+#
+# DB.pool.on_checkout_event = proc do |event|
+# case event
+# when :immediately_available
+# mutex.synchronize do
+# total += 1
+# immediates += 1
+# end
+# when :not_immediately_available
+# mutex.synchronize do
+# total += 1
+# end
+# end
+# end
+#
+# immediate_percentage = lambda do
+# mutex.synchronize do
+# 100.0 * immediates / total
+# end
+# end
+#
+# Note that this extension only works with the timed_queue
+# and sharded_timed_queue connection pools (the default
+# connection pools when using Ruby 3.2+).
+#
+# Related modules: Sequel::ConnectionCheckoutEventCallbacks::TimedQueue,
+# Sequel::ConnectionCheckoutEventCallbacks::ShardedTimedQueue
+
+#
+module Sequel
+ module ConnectionCheckoutEventCallbacks
+ module TimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available)
+ conn
+ end
+
+ def try_make_new
+ conn = super
+ @on_checkout_event.call(:new_connection) if conn
+ conn
+ end
+
+ def wait_until_available
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer))
+ conn
+ end
+ end
+
+ module ShardedTimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available(queue, server)
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available, server)
+ conn
+ end
+
+ def try_make_new(server)
+ conn = super
+ @on_checkout_event.call(:new_connection, server) if conn
+ conn
+ end
+
+ def wait_until_available(queue, server)
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer), server)
+ conn
+ end
+ end
+ end
+
+ default_callback = proc{}
+
+ Database.register_extension(:connection_checkout_event_callback) do |db|
+ pool = db.pool
+
+ case pool.pool_type
+ when :timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::TimedQueue)
+ when :sharded_timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::ShardedTimedQueue)
+ else
+ raise Error, "the connection_checkout_event_callback extension is only supported when using a timed_queue connection pool"
+ end
+
+ pool.on_checkout_event ||= default_callback
+ end
+end
* Changed:
lib/sequel/connection_pool.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:10.249001211 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:10.294001413 +0000
@@ -133,0 +134,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, *)
+ disconnect_connection(conn)
+ end
+
lib/sequel/connection_pool/sharded_timed_queue.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:10.249001211 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:10.294001413 +0000
@@ -74 +74 @@
- break unless (conn = queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available(queue, server)) && !conns[conn]
@@ -98 +98 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -170 +170 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -227,0 +228,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, _, server)
+ disconnect_pool_connection(conn, server)
+ end
+
@@ -314 +320 @@
- if conn = queue.pop(timeout: 0) || try_make_new(server) || queue.pop(timeout: @timeout)
+ if conn = available(queue, server) || try_make_new(server) || wait_until_available(queue, server)
@@ -319,0 +326,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available(queue, _server)
+ queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available(queue, _server)
+ queue.pop(timeout: @timeout)
lib/sequel/connection_pool/timed_queue.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:10.250001216 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:10.295001418 +0000
@@ -45 +45 @@
- break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available) && !conns[conn]
@@ -62 +62 @@
- while conn = @queue.pop(timeout: 0)
+ while conn = available
@@ -223 +223 @@
- if conn = @queue.pop(timeout: 0) || try_make_new || @queue.pop(timeout: @timeout)
+ if conn = available || try_make_new || wait_until_available
@@ -228,0 +229,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available
+ @queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available
+ @queue.pop(timeout: @timeout)
lib/sequel/extensions/connection_expiration.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:10.256001243 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:10.302001449 +0000
@@ -94 +94 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/extensions/connection_validator.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:10.256001243 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:10.302001449 +0000
@@ -121 +121 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/version.rb
--- /tmp/d20260302-1549-i0sumj/sequel-5.101.0/lib/sequel/version.rb 2026-03-02 03:33:10.285001373 +0000
+++ /tmp/d20260302-1549-i0sumj/sequel-5.102.0/lib/sequel/version.rb 2026-03-02 03:33:10.334001593 +0000
@@ -9 +9 @@
- MINOR = 101
+ MINOR = 102 |
Contributor
gem compare --diff sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb
--- /tmp/20260302-1589-sz8ljn 2026-03-02 03:33:10.307347271 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/extensions/connection_checkout_event_callback.rb 2026-03-02 03:33:10.276347185 +0000
@@ -0,0 +1,151 @@
+# frozen-string-literal: true
+#
+# The connection_checkout_event_callback extension modifies a database's
+# connection pool to allow for a checkout event callback. This callback is
+# called with the following arguments:
+#
+# :immediately_available :: Connection immediately available and returned
+# :not_immediately_available :: Connection not immediately available
+# :new_connection :: New connection created and returned
+# Float :: Number of seconds waiting to acquire a connection
+#
+# This is a low-level extension that allows for building telemetry
+# information. It doesn't implement any telemetry reporting itself. The
+# main reason for recording this information is to use it to determine the
+# appropriate size for the connection pool. Having too large a connection
+# pool can waste resources, while having too small a connection pool can
+# result in substantial time to check out a connection. In general, you
+# want to use as small a pool as possible while keeping the time to
+# checkout a connection low.
+#
+# To use the connection checkout event callback, you must first load the
+# extension:
+#
+# DB.extension(:connection_checkout_event_callback)
+#
+# By default, an empty proc is used as the callback so that loading the
+# support doesn't break anything. If you are using the extension, you
+# should set the callback at some point during application startup:
+#
+# DB.pool.on_checkout_event = proc do |event|
+# # ...
+# end
+#
+# When using the sharded connection pool, the callback is also
+# passed a second argument, the requested server shard (generally a
+# symbol), allowing for collection of per-shard telemetry:
+#
+# DB.pool.on_checkout_event = proc do |event, server|
+# # ...
+# end
+#
+# Note that the callback may be called currently by multiple threads.
+# You should use some form of concurrency control inside the callback,
+# such as a mutex or queue.
+#
+# Below is a brief example of usage to determine the percentage of
+# connection requests where a connection was immediately available:
+#
+# mutex = Mutex.new
+# total = immediates = 0
+#
+# DB.pool.on_checkout_event = proc do |event|
+# case event
+# when :immediately_available
+# mutex.synchronize do
+# total += 1
+# immediates += 1
+# end
+# when :not_immediately_available
+# mutex.synchronize do
+# total += 1
+# end
+# end
+# end
+#
+# immediate_percentage = lambda do
+# mutex.synchronize do
+# 100.0 * immediates / total
+# end
+# end
+#
+# Note that this extension only works with the timed_queue
+# and sharded_timed_queue connection pools (the default
+# connection pools when using Ruby 3.2+).
+#
+# Related modules: Sequel::ConnectionCheckoutEventCallbacks::TimedQueue,
+# Sequel::ConnectionCheckoutEventCallbacks::ShardedTimedQueue
+
+#
+module Sequel
+ module ConnectionCheckoutEventCallbacks
+ module TimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available)
+ conn
+ end
+
+ def try_make_new
+ conn = super
+ @on_checkout_event.call(:new_connection) if conn
+ conn
+ end
+
+ def wait_until_available
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer))
+ conn
+ end
+ end
+
+ module ShardedTimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available(queue, server)
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available, server)
+ conn
+ end
+
+ def try_make_new(server)
+ conn = super
+ @on_checkout_event.call(:new_connection, server) if conn
+ conn
+ end
+
+ def wait_until_available(queue, server)
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer), server)
+ conn
+ end
+ end
+ end
+
+ default_callback = proc{}
+
+ Database.register_extension(:connection_checkout_event_callback) do |db|
+ pool = db.pool
+
+ case pool.pool_type
+ when :timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::TimedQueue)
+ when :sharded_timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::ShardedTimedQueue)
+ else
+ raise Error, "the connection_checkout_event_callback extension is only supported when using a timed_queue connection pool"
+ end
+
+ pool.on_checkout_event ||= default_callback
+ end
+end
* Changed:
lib/sequel/connection_pool.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:10.225347044 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:10.269347165 +0000
@@ -133,0 +134,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, *)
+ disconnect_connection(conn)
+ end
+
lib/sequel/connection_pool/sharded_timed_queue.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:10.226347046 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:10.269347165 +0000
@@ -74 +74 @@
- break unless (conn = queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available(queue, server)) && !conns[conn]
@@ -98 +98 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -170 +170 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -227,0 +228,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, _, server)
+ disconnect_pool_connection(conn, server)
+ end
+
@@ -314 +320 @@
- if conn = queue.pop(timeout: 0) || try_make_new(server) || queue.pop(timeout: @timeout)
+ if conn = available(queue, server) || try_make_new(server) || wait_until_available(queue, server)
@@ -319,0 +326,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available(queue, _server)
+ queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available(queue, _server)
+ queue.pop(timeout: @timeout)
lib/sequel/connection_pool/timed_queue.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:10.226347046 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:10.270347168 +0000
@@ -45 +45 @@
- break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available) && !conns[conn]
@@ -62 +62 @@
- while conn = @queue.pop(timeout: 0)
+ while conn = available
@@ -223 +223 @@
- if conn = @queue.pop(timeout: 0) || try_make_new || @queue.pop(timeout: @timeout)
+ if conn = available || try_make_new || wait_until_available
@@ -228,0 +229,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available
+ @queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available
+ @queue.pop(timeout: @timeout)
lib/sequel/extensions/connection_expiration.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:10.232347063 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:10.276347185 +0000
@@ -94 +94 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/extensions/connection_validator.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:10.232347063 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:10.276347185 +0000
@@ -121 +121 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/version.rb
--- /tmp/d20260302-1589-ri2ges/sequel-5.101.0/lib/sequel/version.rb 2026-03-02 03:33:10.260347140 +0000
+++ /tmp/d20260302-1589-ri2ges/sequel-5.102.0/lib/sequel/version.rb 2026-03-02 03:33:10.306347268 +0000
@@ -9 +9 @@
- MINOR = 101
+ MINOR = 102 |
Contributor
gem compare sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT version:
5.101.0: 5.101.0
5.102.0: 5.102.0
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb +151/-0
* Changed:
lib/sequel/connection_pool.rb +6/-0
lib/sequel/connection_pool/sharded_timed_queue.rb +23/-4
lib/sequel/connection_pool/timed_queue.rb +16/-3
lib/sequel/extensions/connection_expiration.rb +1/-1
lib/sequel/extensions/connection_validator.rb +1/-1
lib/sequel/version.rb +1/-1 |
1 similar comment
Contributor
gem compare sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT version:
5.101.0: 5.101.0
5.102.0: 5.102.0
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb +151/-0
* Changed:
lib/sequel/connection_pool.rb +6/-0
lib/sequel/connection_pool/sharded_timed_queue.rb +23/-4
lib/sequel/connection_pool/timed_queue.rb +16/-3
lib/sequel/extensions/connection_expiration.rb +1/-1
lib/sequel/extensions/connection_validator.rb +1/-1
lib/sequel/version.rb +1/-1 |
Contributor
gem compare --diff sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb
--- /tmp/20260302-1622-1flxtc 2026-03-02 03:33:17.091657391 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/extensions/connection_checkout_event_callback.rb 2026-03-02 03:33:17.021657615 +0000
@@ -0,0 +1,151 @@
+# frozen-string-literal: true
+#
+# The connection_checkout_event_callback extension modifies a database's
+# connection pool to allow for a checkout event callback. This callback is
+# called with the following arguments:
+#
+# :immediately_available :: Connection immediately available and returned
+# :not_immediately_available :: Connection not immediately available
+# :new_connection :: New connection created and returned
+# Float :: Number of seconds waiting to acquire a connection
+#
+# This is a low-level extension that allows for building telemetry
+# information. It doesn't implement any telemetry reporting itself. The
+# main reason for recording this information is to use it to determine the
+# appropriate size for the connection pool. Having too large a connection
+# pool can waste resources, while having too small a connection pool can
+# result in substantial time to check out a connection. In general, you
+# want to use as small a pool as possible while keeping the time to
+# checkout a connection low.
+#
+# To use the connection checkout event callback, you must first load the
+# extension:
+#
+# DB.extension(:connection_checkout_event_callback)
+#
+# By default, an empty proc is used as the callback so that loading the
+# support doesn't break anything. If you are using the extension, you
+# should set the callback at some point during application startup:
+#
+# DB.pool.on_checkout_event = proc do |event|
+# # ...
+# end
+#
+# When using the sharded connection pool, the callback is also
+# passed a second argument, the requested server shard (generally a
+# symbol), allowing for collection of per-shard telemetry:
+#
+# DB.pool.on_checkout_event = proc do |event, server|
+# # ...
+# end
+#
+# Note that the callback may be called currently by multiple threads.
+# You should use some form of concurrency control inside the callback,
+# such as a mutex or queue.
+#
+# Below is a brief example of usage to determine the percentage of
+# connection requests where a connection was immediately available:
+#
+# mutex = Mutex.new
+# total = immediates = 0
+#
+# DB.pool.on_checkout_event = proc do |event|
+# case event
+# when :immediately_available
+# mutex.synchronize do
+# total += 1
+# immediates += 1
+# end
+# when :not_immediately_available
+# mutex.synchronize do
+# total += 1
+# end
+# end
+# end
+#
+# immediate_percentage = lambda do
+# mutex.synchronize do
+# 100.0 * immediates / total
+# end
+# end
+#
+# Note that this extension only works with the timed_queue
+# and sharded_timed_queue connection pools (the default
+# connection pools when using Ruby 3.2+).
+#
+# Related modules: Sequel::ConnectionCheckoutEventCallbacks::TimedQueue,
+# Sequel::ConnectionCheckoutEventCallbacks::ShardedTimedQueue
+
+#
+module Sequel
+ module ConnectionCheckoutEventCallbacks
+ module TimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available)
+ conn
+ end
+
+ def try_make_new
+ conn = super
+ @on_checkout_event.call(:new_connection) if conn
+ conn
+ end
+
+ def wait_until_available
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer))
+ conn
+ end
+ end
+
+ module ShardedTimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available(queue, server)
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available, server)
+ conn
+ end
+
+ def try_make_new(server)
+ conn = super
+ @on_checkout_event.call(:new_connection, server) if conn
+ conn
+ end
+
+ def wait_until_available(queue, server)
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer), server)
+ conn
+ end
+ end
+ end
+
+ default_callback = proc{}
+
+ Database.register_extension(:connection_checkout_event_callback) do |db|
+ pool = db.pool
+
+ case pool.pool_type
+ when :timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::TimedQueue)
+ when :sharded_timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::ShardedTimedQueue)
+ else
+ raise Error, "the connection_checkout_event_callback extension is only supported when using a timed_queue connection pool"
+ end
+
+ pool.on_checkout_event ||= default_callback
+ end
+end
* Changed:
lib/sequel/connection_pool.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:16.917657948 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:16.993657704 +0000
@@ -133,0 +134,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, *)
+ disconnect_connection(conn)
+ end
+
lib/sequel/connection_pool/sharded_timed_queue.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:16.919657942 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:16.993657704 +0000
@@ -74 +74 @@
- break unless (conn = queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available(queue, server)) && !conns[conn]
@@ -98 +98 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -170 +170 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -227,0 +228,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, _, server)
+ disconnect_pool_connection(conn, server)
+ end
+
@@ -314 +320 @@
- if conn = queue.pop(timeout: 0) || try_make_new(server) || queue.pop(timeout: @timeout)
+ if conn = available(queue, server) || try_make_new(server) || wait_until_available(queue, server)
@@ -319,0 +326,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available(queue, _server)
+ queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available(queue, _server)
+ queue.pop(timeout: @timeout)
lib/sequel/connection_pool/timed_queue.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:16.920657939 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:16.994657701 +0000
@@ -45 +45 @@
- break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available) && !conns[conn]
@@ -62 +62 @@
- while conn = @queue.pop(timeout: 0)
+ while conn = available
@@ -223 +223 @@
- if conn = @queue.pop(timeout: 0) || try_make_new || @queue.pop(timeout: @timeout)
+ if conn = available || try_make_new || wait_until_available
@@ -228,0 +229,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available
+ @queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available
+ @queue.pop(timeout: @timeout)
lib/sequel/extensions/connection_expiration.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:16.929657910 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:17.021657615 +0000
@@ -94 +94 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/extensions/connection_validator.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:16.929657910 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:17.023657609 +0000
@@ -121 +121 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/version.rb
--- /tmp/d20260302-1622-os42rv/sequel-5.101.0/lib/sequel/version.rb 2026-03-02 03:33:16.975657762 +0000
+++ /tmp/d20260302-1622-os42rv/sequel-5.102.0/lib/sequel/version.rb 2026-03-02 03:33:17.090657395 +0000
@@ -9 +9 @@
- MINOR = 101
+ MINOR = 102 |
Contributor
gem compare --diff sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb
--- /tmp/20260302-1546-76uugd 2026-03-02 03:33:27.863959669 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/extensions/connection_checkout_event_callback.rb 2026-03-02 03:33:27.826959300 +0000
@@ -0,0 +1,151 @@
+# frozen-string-literal: true
+#
+# The connection_checkout_event_callback extension modifies a database's
+# connection pool to allow for a checkout event callback. This callback is
+# called with the following arguments:
+#
+# :immediately_available :: Connection immediately available and returned
+# :not_immediately_available :: Connection not immediately available
+# :new_connection :: New connection created and returned
+# Float :: Number of seconds waiting to acquire a connection
+#
+# This is a low-level extension that allows for building telemetry
+# information. It doesn't implement any telemetry reporting itself. The
+# main reason for recording this information is to use it to determine the
+# appropriate size for the connection pool. Having too large a connection
+# pool can waste resources, while having too small a connection pool can
+# result in substantial time to check out a connection. In general, you
+# want to use as small a pool as possible while keeping the time to
+# checkout a connection low.
+#
+# To use the connection checkout event callback, you must first load the
+# extension:
+#
+# DB.extension(:connection_checkout_event_callback)
+#
+# By default, an empty proc is used as the callback so that loading the
+# support doesn't break anything. If you are using the extension, you
+# should set the callback at some point during application startup:
+#
+# DB.pool.on_checkout_event = proc do |event|
+# # ...
+# end
+#
+# When using the sharded connection pool, the callback is also
+# passed a second argument, the requested server shard (generally a
+# symbol), allowing for collection of per-shard telemetry:
+#
+# DB.pool.on_checkout_event = proc do |event, server|
+# # ...
+# end
+#
+# Note that the callback may be called currently by multiple threads.
+# You should use some form of concurrency control inside the callback,
+# such as a mutex or queue.
+#
+# Below is a brief example of usage to determine the percentage of
+# connection requests where a connection was immediately available:
+#
+# mutex = Mutex.new
+# total = immediates = 0
+#
+# DB.pool.on_checkout_event = proc do |event|
+# case event
+# when :immediately_available
+# mutex.synchronize do
+# total += 1
+# immediates += 1
+# end
+# when :not_immediately_available
+# mutex.synchronize do
+# total += 1
+# end
+# end
+# end
+#
+# immediate_percentage = lambda do
+# mutex.synchronize do
+# 100.0 * immediates / total
+# end
+# end
+#
+# Note that this extension only works with the timed_queue
+# and sharded_timed_queue connection pools (the default
+# connection pools when using Ruby 3.2+).
+#
+# Related modules: Sequel::ConnectionCheckoutEventCallbacks::TimedQueue,
+# Sequel::ConnectionCheckoutEventCallbacks::ShardedTimedQueue
+
+#
+module Sequel
+ module ConnectionCheckoutEventCallbacks
+ module TimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available)
+ conn
+ end
+
+ def try_make_new
+ conn = super
+ @on_checkout_event.call(:new_connection) if conn
+ conn
+ end
+
+ def wait_until_available
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer))
+ conn
+ end
+ end
+
+ module ShardedTimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available(queue, server)
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available, server)
+ conn
+ end
+
+ def try_make_new(server)
+ conn = super
+ @on_checkout_event.call(:new_connection, server) if conn
+ conn
+ end
+
+ def wait_until_available(queue, server)
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer), server)
+ conn
+ end
+ end
+ end
+
+ default_callback = proc{}
+
+ Database.register_extension(:connection_checkout_event_callback) do |db|
+ pool = db.pool
+
+ case pool.pool_type
+ when :timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::TimedQueue)
+ when :sharded_timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::ShardedTimedQueue)
+ else
+ raise Error, "the connection_checkout_event_callback extension is only supported when using a timed_queue connection pool"
+ end
+
+ pool.on_checkout_event ||= default_callback
+ end
+end
* Changed:
lib/sequel/connection_pool.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:27.766958703 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:27.819959231 +0000
@@ -133,0 +134,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, *)
+ disconnect_connection(conn)
+ end
+
lib/sequel/connection_pool/sharded_timed_queue.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:27.766958703 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:27.820959241 +0000
@@ -74 +74 @@
- break unless (conn = queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available(queue, server)) && !conns[conn]
@@ -98 +98 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -170 +170 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -227,0 +228,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, _, server)
+ disconnect_pool_connection(conn, server)
+ end
+
@@ -314 +320 @@
- if conn = queue.pop(timeout: 0) || try_make_new(server) || queue.pop(timeout: @timeout)
+ if conn = available(queue, server) || try_make_new(server) || wait_until_available(queue, server)
@@ -319,0 +326,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available(queue, _server)
+ queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available(queue, _server)
+ queue.pop(timeout: @timeout)
lib/sequel/connection_pool/timed_queue.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:27.767958713 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:27.820959241 +0000
@@ -45 +45 @@
- break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available) && !conns[conn]
@@ -62 +62 @@
- while conn = @queue.pop(timeout: 0)
+ while conn = available
@@ -223 +223 @@
- if conn = @queue.pop(timeout: 0) || try_make_new || @queue.pop(timeout: @timeout)
+ if conn = available || try_make_new || wait_until_available
@@ -228,0 +229,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available
+ @queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available
+ @queue.pop(timeout: @timeout)
lib/sequel/extensions/connection_expiration.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:27.775958793 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:27.826959300 +0000
@@ -94 +94 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/extensions/connection_validator.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:27.775958793 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:27.826959300 +0000
@@ -121 +121 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/version.rb
--- /tmp/d20260302-1546-4kyvzm/sequel-5.101.0/lib/sequel/version.rb 2026-03-02 03:33:27.810959141 +0000
+++ /tmp/d20260302-1546-4kyvzm/sequel-5.102.0/lib/sequel/version.rb 2026-03-02 03:33:27.862959659 +0000
@@ -9 +9 @@
- MINOR = 101
+ MINOR = 102 |
Contributor
gem compare --diff sequel 5.101.0 5.102.0Compared versions: ["5.101.0", "5.102.0"]
DIFFERENT files:
5.101.0->5.102.0:
* Added:
lib/sequel/extensions/connection_checkout_event_callback.rb
--- /tmp/20260302-1641-neeil5 2026-03-02 03:33:30.860826162 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/extensions/connection_checkout_event_callback.rb 2026-03-02 03:33:30.802825801 +0000
@@ -0,0 +1,151 @@
+# frozen-string-literal: true
+#
+# The connection_checkout_event_callback extension modifies a database's
+# connection pool to allow for a checkout event callback. This callback is
+# called with the following arguments:
+#
+# :immediately_available :: Connection immediately available and returned
+# :not_immediately_available :: Connection not immediately available
+# :new_connection :: New connection created and returned
+# Float :: Number of seconds waiting to acquire a connection
+#
+# This is a low-level extension that allows for building telemetry
+# information. It doesn't implement any telemetry reporting itself. The
+# main reason for recording this information is to use it to determine the
+# appropriate size for the connection pool. Having too large a connection
+# pool can waste resources, while having too small a connection pool can
+# result in substantial time to check out a connection. In general, you
+# want to use as small a pool as possible while keeping the time to
+# checkout a connection low.
+#
+# To use the connection checkout event callback, you must first load the
+# extension:
+#
+# DB.extension(:connection_checkout_event_callback)
+#
+# By default, an empty proc is used as the callback so that loading the
+# support doesn't break anything. If you are using the extension, you
+# should set the callback at some point during application startup:
+#
+# DB.pool.on_checkout_event = proc do |event|
+# # ...
+# end
+#
+# When using the sharded connection pool, the callback is also
+# passed a second argument, the requested server shard (generally a
+# symbol), allowing for collection of per-shard telemetry:
+#
+# DB.pool.on_checkout_event = proc do |event, server|
+# # ...
+# end
+#
+# Note that the callback may be called currently by multiple threads.
+# You should use some form of concurrency control inside the callback,
+# such as a mutex or queue.
+#
+# Below is a brief example of usage to determine the percentage of
+# connection requests where a connection was immediately available:
+#
+# mutex = Mutex.new
+# total = immediates = 0
+#
+# DB.pool.on_checkout_event = proc do |event|
+# case event
+# when :immediately_available
+# mutex.synchronize do
+# total += 1
+# immediates += 1
+# end
+# when :not_immediately_available
+# mutex.synchronize do
+# total += 1
+# end
+# end
+# end
+#
+# immediate_percentage = lambda do
+# mutex.synchronize do
+# 100.0 * immediates / total
+# end
+# end
+#
+# Note that this extension only works with the timed_queue
+# and sharded_timed_queue connection pools (the default
+# connection pools when using Ruby 3.2+).
+#
+# Related modules: Sequel::ConnectionCheckoutEventCallbacks::TimedQueue,
+# Sequel::ConnectionCheckoutEventCallbacks::ShardedTimedQueue
+
+#
+module Sequel
+ module ConnectionCheckoutEventCallbacks
+ module TimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available)
+ conn
+ end
+
+ def try_make_new
+ conn = super
+ @on_checkout_event.call(:new_connection) if conn
+ conn
+ end
+
+ def wait_until_available
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer))
+ conn
+ end
+ end
+
+ module ShardedTimedQueue
+ # The callback that is called with connection checkout events.
+ attr_accessor :on_checkout_event
+
+ private
+
+ def available(queue, server)
+ conn = super
+ @on_checkout_event.call(conn ? :immediately_available : :not_immediately_available, server)
+ conn
+ end
+
+ def try_make_new(server)
+ conn = super
+ @on_checkout_event.call(:new_connection, server) if conn
+ conn
+ end
+
+ def wait_until_available(queue, server)
+ timer = Sequel.start_timer
+ conn = super
+ @on_checkout_event.call(Sequel.elapsed_seconds_since(timer), server)
+ conn
+ end
+ end
+ end
+
+ default_callback = proc{}
+
+ Database.register_extension(:connection_checkout_event_callback) do |db|
+ pool = db.pool
+
+ case pool.pool_type
+ when :timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::TimedQueue)
+ when :sharded_timed_queue
+ db.pool.extend(ConnectionCheckoutEventCallbacks::ShardedTimedQueue)
+ else
+ raise Error, "the connection_checkout_event_callback extension is only supported when using a timed_queue connection pool"
+ end
+
+ pool.on_checkout_event ||= default_callback
+ end
+end
* Changed:
lib/sequel/connection_pool.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:30.725825321 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/connection_pool.rb 2026-03-02 03:33:30.791825732 +0000
@@ -133,0 +134,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, *)
+ disconnect_connection(conn)
+ end
+
lib/sequel/connection_pool/sharded_timed_queue.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:30.727825334 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/connection_pool/sharded_timed_queue.rb 2026-03-02 03:33:30.792825739 +0000
@@ -74 +74 @@
- break unless (conn = queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available(queue, server)) && !conns[conn]
@@ -98 +98 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -170 +170 @@
- while conn = queue.pop(timeout: 0)
+ while conn = available(queue, server)
@@ -227,0 +228,6 @@
+ # Only for use by extension that need to disconnect a connection inside acquire.
+ # Takes the connection and any arguments accepted by acquire.
+ def disconnect_acquired_connection(conn, _, server)
+ disconnect_pool_connection(conn, server)
+ end
+
@@ -314 +320 @@
- if conn = queue.pop(timeout: 0) || try_make_new(server) || queue.pop(timeout: @timeout)
+ if conn = available(queue, server) || try_make_new(server) || wait_until_available(queue, server)
@@ -319,0 +326,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available(queue, _server)
+ queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available(queue, _server)
+ queue.pop(timeout: @timeout)
lib/sequel/connection_pool/timed_queue.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:30.727825334 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/connection_pool/timed_queue.rb 2026-03-02 03:33:30.793825745 +0000
@@ -45 +45 @@
- break unless (conn = @queue.pop(timeout: 0)) && !conns[conn]
+ break unless (conn = available) && !conns[conn]
@@ -62 +62 @@
- while conn = @queue.pop(timeout: 0)
+ while conn = available
@@ -223 +223 @@
- if conn = @queue.pop(timeout: 0) || try_make_new || @queue.pop(timeout: @timeout)
+ if conn = available || try_make_new || wait_until_available
@@ -228,0 +229,13 @@
+ end
+
+ # Return the next connection in the pool if there is one available. Returns nil
+ # if no connection is currently available.
+ def available
+ @queue.pop(timeout: 0)
+ end
+
+ # Return the next connection in the pool if there is one available. If not, wait
+ # until the timeout for a connection to become available. If there is still no
+ # available connection, return nil.
+ def wait_until_available
+ @queue.pop(timeout: @timeout)
lib/sequel/extensions/connection_expiration.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:30.736825390 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/extensions/connection_expiration.rb 2026-03-02 03:33:30.803825807 +0000
@@ -94 +94 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/extensions/connection_validator.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:30.736825390 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/extensions/connection_validator.rb 2026-03-02 03:33:30.803825807 +0000
@@ -121 +121 @@
- disconnect_connection(conn)
+ disconnect_acquired_connection(conn, *a)
lib/sequel/version.rb
--- /tmp/d20260302-1641-xtxp5x/sequel-5.101.0/lib/sequel/version.rb 2026-03-02 03:33:30.777825645 +0000
+++ /tmp/d20260302-1641-xtxp5x/sequel-5.102.0/lib/sequel/version.rb 2026-03-02 03:33:30.859826155 +0000
@@ -9 +9 @@
- MINOR = 101
+ MINOR = 102 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumps sequel from 5.101.0 to 5.102.0.
Changelog
Sourced from sequel's changelog.
Commits
7948e9bBump version to 5.102.0ab35255Avoid nondeterministic behavior in timed queue connection pool specs3caf120Make connection_validator and connection_expiration extensions correct handle...cb8d60dRemove extra + in rdoc formattingc556c41Fix doc typo: s/Sequel.connection/Sequel.connect/4bce385Fix nondeterministic test failure in connection_checkout_event_callback spec211a41eAdd connection_checkout_event_callback extension to assist in collecting tele...54b745cAdd available and wait_until_available methods to timed queue connection poolsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)