Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irssi_logger.pl update - the script now checks for DB disconnects and reconnects if disconnected #880

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion scripts/irssi_logger.pl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,13 @@

defined or $_ = "" for @vals;

$dbh->do($sql, undef, @vals) || Irssi::print("Can't log to DB! " . DBI::errstr);
$dbh->do($sql, undef, @vals);
if ($dbh->err) {
Irssi::print("Can't log to DB! " . DBI::errstr);
if (!$dbh->ping) {
$dbh->connect();
}
}
}
}

Expand All @@ -127,7 +133,7 @@
write_db($server->{nick}, $message, $target);
}

sub log {

Check warning on line 136 in scripts/irssi_logger.pl

View workflow job for this annotation

GitHub Actions / test

Subroutine name is a homonym for builtin function log
my ($server, $message, $nick, $address, $target) = @_;
write_db($nick, $message, $target)
}
Expand Down
Loading