[Debian-l10n-commits] [ddtp] 02/03: Log error messages and release DB connection correctly.

Martijn van Oosterhout kleptog-guest at moszumanska.debian.org
Sat Mar 29 07:19:23 UTC 2014


This is an automated email from the git hooks/post-receive script.

kleptog-guest pushed a commit to branch master
in repository ddtp.

commit 1db2ff159f6fef455ee21b94c2c69897347099e9
Author: Martijn van Oosterhout <kleptog at svana.org>
Date:   Sat Mar 29 07:14:08 2014 +0000

    Log error messages and release DB connection correctly.
    
    If there was a problem processing the packages the idea was to skip and
    continue.  Instead, because it didn't release the database connection it
    actually caused a fatal error later.
    
    Also, since this code only really run from the webserver, conditioning on
    stderr being a terminal means nothing ever gets logged.
---
 ddtss/DDTSS_Pg.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/ddtss/DDTSS_Pg.pm b/ddtss/DDTSS_Pg.pm
index 4b71f6b..a326c25 100644
--- a/ddtss/DDTSS_Pg.pm
+++ b/ddtss/DDTSS_Pg.pm
@@ -680,15 +680,17 @@ sub submit_one_package
   # Substitute translated description in, for logs
   unless( $data =~ s/^Description-[\w.-]+:(( .*)?\n)+#/Description-$lang.UTF-8: $short\n$long\n#/m )
   {
-    -t STDERR and print STDERR "Substitution failed for $package, not sending ($data)\n";
-    next;
+    print STDERR "Substitution failed for $package (lang $lang), not sending ($data)\n";
+    DDTSS_Close($db);
+    return;
   }
 
   # Extract description for submitting to db
   my $description = $data;
   unless( $description =~ s/.*^Description: ((.*?)\n.*)^Description-.*/$1/ms )
   {
-    -t STDERR and print STDERR "Substitution failed for $package, not sending ($description)\n";
+    print STDERR "Substitution failed for $package (lang $lang), not sending ($description)\n";
+    DDTSS_Close($db);
     return;
   }
   my $newshort = $2;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-l10n/ddtp.git



More information about the Debian-l10n-commits mailing list