Sha256: 29c90b1ced58ae2732e7346985117d495cdaf6078970326d74a4c1cf166130e7
Contents?: true
Size: 643 Bytes
Versions: 3
Compression:
Stored size: 643 Bytes
Contents
module ActionCable module Server class Worker # Clear active connections between units of work so the long-running channel or connection processes do not hoard connections. module ActiveRecordConnectionManagement extend ActiveSupport::Concern included do if defined?(ActiveRecord::Base) set_callback :work, :around, :with_database_connections end end def with_database_connections connection.logger.tag(ActiveRecord::Base.logger) { yield } ensure ActiveRecord::Base.clear_active_connections! end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems