diff --git a/lib/sites/parser.pm b/lib/sites/parser.pm index 12d744f7e47e71faea447e73ea698df5d1619b29..8e72e44469a22a5e9f4a7664d0ef9fdcd482f7e9 100644 --- a/lib/sites/parser.pm +++ b/lib/sites/parser.pm @@ -73,8 +73,6 @@ sub parse { $sth->execute($content{'site'}, $content{'url'}, $content{'author'}, $content{'title'}, $content{'duration'}); - - $dbh->commit; }; if ($@) { $log->error("Couldn't finish transaction: " . $@); @@ -82,21 +80,13 @@ sub parse { } # sélection de l'id de la vidéo insérée - $id = $sth->{mysql_insertid}; - if (!$id) { - # la vido avait déjà été insérée - # L'état de la bdd est stable (puisqu'on a en fait rien fait), - # on peut commiter. - $dbh->commit; - - my $sth = $dbh->prepare('SELECT id FROM playbot WHERE url = ?'); - $log->error("Couldn't prepare querie; aborting") unless (defined $sth); + my $sth = $dbh->prepare('SELECT id FROM playbot WHERE url = ?'); + $log->error("Couldn't prepare querie; aborting") unless (defined $sth); - $sth->execute($content{'url'}) - or $log->error("Couldn't finish transaction: " . $dbh->errstr); + $sth->execute($content{'url'}) + or $log->error("Couldn't finish transaction: " . $dbh->errstr); - $id = $sth->fetch->[0]; - } + $id = $sth->fetch->[0]; # insertion du chan my $sth = $dbh->prepare(' @@ -107,7 +97,6 @@ sub parse { $sth->execute($id, $chan->[0], $nick) or $log->error("Couldn't finish transaction: " . $dbh->errstr); - # in all cases, we commit now $dbh->commit; commands::parser::tag($msg, $chan);