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"
|
||||
class ActiveRecord::ConnectionAdapters::AbstractAdapter
|
||||
module LastUseExtension
|
||||
attr_reader :last_use, :first_use
|
||||
def initialize(connection, logger = nil, pool = nil)
|
||||
super
|
||||
@last_use = false
|
||||
@first_use = Time.now
|
||||
end
|
||||
|
||||
def initialize(connection, logger = nil, pool = nil)
|
||||
super
|
||||
@last_use = false
|
||||
@first_use = Time.now
|
||||
end
|
||||
|
||||
def lease
|
||||
@lock.synchronize do
|
||||
unless in_use?
|
||||
@last_use = Time.now
|
||||
super
|
||||
end
|
||||
def lease
|
||||
@lock.synchronize do
|
||||
unless in_use?
|
||||
@last_use = Time.now
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
prepend LastUseExtension
|
||||
end
|
||||
|
||||
prepend LastUseExtension
|
||||
end
|
||||
|
||||
class ActiveRecord::ConnectionAdapters::ConnectionPool
|
||||
|
Loading…
Reference in New Issue
Block a user