Skip to content

Commit

Permalink
fix: Remove MySQL unused lock variable and broaden SQLite detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros committed Feb 11, 2024
1 parent a3166e2 commit 2f0f948
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/with_advisory_lock/database_adapter_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,22 @@

module WithAdvisoryLock
class DatabaseAdapterSupport
# Caches nested lock support by MySQL reported version
@@mysql_nl_cache = {}
@@mysql_nl_cache_mutex = Mutex.new

attr_reader :adapter_name
def initialize(connection)
@connection = connection
@sym_name = connection.adapter_name.downcase.to_sym
@adapter_name = connection.adapter_name.downcase.to_sym
end

def mysql?
%i[mysql2 trilogy].include? @sym_name
%i[mysql2 trilogy].include? adapter_name
end

def postgresql?
%i[postgresql empostgresql postgis].include? @sym_name
%i[postgresql empostgresql postgis].include? adapter_name
end

def sqlite?
@sym_name == :sqlite3
[:sqlite3, :sqlite].include? adapter_name
end
end
end

0 comments on commit 2f0f948

Please sign in to comment.