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
|
|
|
|
|
|
|
|
|
|
|
|
# ActiveRecord/sqlite3 has locking issues when you update a table with a pending select
|
|
|
|
# This set of instance/class wrappers should prevent a table lock
|
2009-11-16 15:16:08 +00:00
|
|
|
# Straight up gangsta from spoon (ripped from BION)
|
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)
|
2009-11-29 23:36:40 +00:00
|
|
|
ActiveRecord::Base.connection_pool.clear_stale_cached_connections!
|
2009-12-04 19:16:28 +00:00
|
|
|
super(*args)
|
2009-11-14 22:11:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def save(*args)
|
2009-11-29 23:36:40 +00:00
|
|
|
ActiveRecord::Base.connection_pool.clear_stale_cached_connections!
|
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
|
|
|
|