method
with_subscriptions_connection
v7.2.3 -
Show latest stable
- Class:
ActionCable::SubscriptionAdapter::PostgreSQL
with_subscriptions_connection(&block)public
No documentation available.
# File actioncable/lib/action_cable/subscription_adapter/postgresql.rb, line 37
def with_subscriptions_connection(&block) # :nodoc:
# Action Cable is taking ownership over this database connection, and will
# perform the necessary cleanup tasks.
# We purposedly avoid #checkout to not end up with a pinned connection
ar_conn = ActiveRecord::Base.connection_pool.new_connection
pg_conn = ar_conn.raw_connection
verify!(pg_conn)
pg_conn.exec("SET application_name = #{pg_conn.escape_identifier(identifier)}")
yield pg_conn
ensure
ar_conn&.disconnect!
end