module Sequel::ConnectionExpiration

  1. lib/sequel/extensions/connection_expiration.rb

Attributes

connection_expiration_random_delay [RW]

The maximum number of seconds that will be added as a random delay to the expiration timeout Defaults to 0 seconds (no random delay).

connection_expiration_timeout [RW]

The number of seconds that need to pass since connection creation before expiring a connection. Defaults to 14400 seconds (4 hours).

Public Class methods

extended(pool)

Initialize the data structures used by this extension.

[show source]
   # File lib/sequel/extensions/connection_expiration.rb
47 def self.extended(pool)
48   case pool.pool_type
49   when :single, :sharded_single
50     raise Error, "cannot load connection_expiration extension if using single or sharded_single connection pool"
51   end
52 
53   pool.instance_exec do
54     sync do
55       @connection_expiration_timestamps ||= {}
56       @connection_expiration_timeout ||= 14400
57       @connection_expiration_random_delay ||= 0
58     end
59   end
60 end