]> git.ktnx.net Git - mpd-feeder.git/commitdiff
move 'connect' method next to the 'disconnect' method
authorDamyan Ivanov <dmn@debian.org>
Tue, 16 Nov 2021 06:25:39 +0000 (06:25 +0000)
committerDamyan Ivanov <dmn@debian.org>
Tue, 16 Nov 2021 06:25:39 +0000 (06:25 +0000)
lib/App/MPD/Feeder/DB.pm

index 5ba1dde2c8a87e35634a2f7dc4abaafc7fc9fd08..ace454c5ef1f305a75bbc27b051268a86a592c18 100644 (file)
@@ -264,18 +264,6 @@ SQL
         );
     }
 
-    method connect {
-        return if $db;
-
-        $db = DBI->connect( "dbi:Pg:dbname=" . $opt->db_path,
-            $opt->db_user, $opt->db_password,
-            { RaiseError => 1, PrintError => 0, AutoCommit => 1 } );
-
-        $log->info( "Connected to database " . $opt->db_path );
-        $generation = $self->get_option('generation');
-        $log->debug("DB generation is $generation");
-    }
-
     method walk_unwanted_artists($callback) {
         $self->connect;
 
@@ -346,6 +334,18 @@ SQL
         return $count;
     }
 
+    method connect {
+        return if $db;
+
+        $db = DBI->connect( "dbi:Pg:dbname=" . $opt->db_path,
+            $opt->db_user, $opt->db_password,
+            { RaiseError => 1, PrintError => 0, AutoCommit => 1 } );
+
+        $log->info( "Connected to database " . $opt->db_path );
+        $generation = $self->get_option('generation');
+        $log->debug("DB generation is $generation");
+    }
+
     method disconnect {
         return unless $db;