2006-03-21 04:37:48 +00:00
|
|
|
module Msf
|
|
|
|
|
2009-12-14 22:52:34 +00:00
|
|
|
|
2006-03-21 04:37:48 +00:00
|
|
|
##
|
|
|
|
#
|
|
|
|
# This module defines all of the DB database tables
|
|
|
|
# and creates ActiveRecord objects for each one of them
|
|
|
|
#
|
|
|
|
##
|
|
|
|
|
|
|
|
class DBManager
|
|
|
|
|
2006-04-03 04:33:30 +00:00
|
|
|
class Lock
|
|
|
|
@@mutex = Mutex.new
|
|
|
|
def self.mutex
|
|
|
|
@@mutex
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2011-04-29 17:22:53 +00:00
|
|
|
#
|
|
|
|
# This inclusion makes sure the connection pool of ActiveRecord is purged frequently
|
|
|
|
#
|
2006-04-03 04:33:30 +00:00
|
|
|
module DBSave
|
|
|
|
|
2006-04-03 04:50:26 +00:00
|
|
|
def self.included(mod)
|
|
|
|
class << mod
|
|
|
|
def find(*args)
|
2010-05-14 15:55:01 +00:00
|
|
|
ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool
|
2009-12-04 19:16:28 +00:00
|
|
|
super(*args)
|
2009-11-14 22:11:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def save(*args)
|
2010-05-14 15:55:01 +00:00
|
|
|
ActiveRecord::Base.connection_pool.clear_stale_cached_connections! if ActiveRecord::Base.connection_pool
|
2009-12-04 19:16:28 +00:00
|
|
|
super(*args)
|
2009-11-14 22:11:53 +00:00
|
|
|
end
|
|
|
|
|
2006-04-03 04:50:26 +00:00
|
|
|
end
|
2006-04-03 04:33:30 +00:00
|
|
|
end
|
2009-11-14 22:11:53 +00:00
|
|
|
|
2006-04-03 04:33:30 +00:00
|
|
|
end
|
|
|
|
|
2006-03-21 04:37:48 +00:00
|
|
|
end
|
2009-05-09 04:18:27 +00:00
|
|
|
end
|
2009-11-14 22:11:53 +00:00
|
|
|
|