From 2f0f948c0208a6573f7ac9edb310c7cb60499c31 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Sun, 11 Feb 2024 13:09:28 +0100 Subject: [PATCH] fix: Remove MySQL unused lock variable and broaden SQLite detection. --- lib/with_advisory_lock/database_adapter_support.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/with_advisory_lock/database_adapter_support.rb b/lib/with_advisory_lock/database_adapter_support.rb index 640c9bc..dafd3ed 100644 --- a/lib/with_advisory_lock/database_adapter_support.rb +++ b/lib/with_advisory_lock/database_adapter_support.rb @@ -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