mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
remove conditional code
This commit is contained in:
parent
1a00aaa825
commit
42847252a4
@ -1,27 +1,24 @@
|
|||||||
|
class ActiveRecord::ConnectionAdapters::AbstractAdapter
|
||||||
|
module LastUseExtension
|
||||||
|
attr_reader :last_use, :first_use
|
||||||
|
|
||||||
if Rails.version >= "4.2.0"
|
def initialize(connection, logger = nil, pool = nil)
|
||||||
class ActiveRecord::ConnectionAdapters::AbstractAdapter
|
super
|
||||||
module LastUseExtension
|
@last_use = false
|
||||||
attr_reader :last_use, :first_use
|
@first_use = Time.now
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(connection, logger = nil, pool = nil)
|
def lease
|
||||||
super
|
@lock.synchronize do
|
||||||
@last_use = false
|
unless in_use?
|
||||||
@first_use = Time.now
|
@last_use = Time.now
|
||||||
end
|
super
|
||||||
|
|
||||||
def lease
|
|
||||||
@lock.synchronize do
|
|
||||||
unless in_use?
|
|
||||||
@last_use = Time.now
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prepend LastUseExtension
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend LastUseExtension
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActiveRecord::ConnectionAdapters::ConnectionPool
|
class ActiveRecord::ConnectionAdapters::ConnectionPool
|
||||||
|
Loading…
Reference in New Issue
Block a user