Fix SessionManager database leak

All database access should be wrapped in with_connection blocks.

Much of this commit is whitespace.  It may help to view it with
--ignore-all-space or the w=0 parameter on GitHub.

[Story #55586616]
bug/bundler_fix
Brandon Turner 2013-08-21 17:28:53 -05:00
parent a815d9277e
commit c0700673e7
1 changed files with 11 additions and 7 deletions

View File

@ -107,13 +107,17 @@ class SessionManager < Hash
# processing time for large session lists from skewing our update interval.
last_seen_timer = Time.now.utc
values.each do |s|
# Update the database entry on a regular basis, marking alive threads
# as recently seen. This notifies other framework instances that this
# session is being maintained.
if framework.db.active and s.db_record
s.db_record.last_seen = Time.now.utc
s.db_record.save
if framework.db.active
::ActiveRecord::Base.connection_pool.with_connection do
values.each do |s|
# Update the database entry on a regular basis, marking alive threads
# as recently seen. This notifies other framework instances that this
# session is being maintained.
if s.db_record
s.db_record.last_seen = Time.now.utc
s.db_record.save
end
end
end
end
end