Closed rmoesbergen closed 7 years ago
Maybe it helps to increase the time-out of the connection to a little more than 10 seconds? If the database (or sphinx cache) is busy, it might take a little longer. Would that also explain why I don't see anything in the logs, because the timeout is a 'die()' call?
`` sub connect2db { $db_user = MailScanner::Config::Value('dbusername') if ( !defined($db_user) ); $db_pass = MailScanner::Config::Value('dbpassword') if ( !defined($db_pass) ); $baruwa_dsn = MailScanner::Config::Value('dbdsn') if ( !defined($baruwa_dsn) ); eval { local $SIG{ALRM} = sub { die "TIMEOUT\n" }; eval { alarm(10); $conn = DBI->connect_cached( $baruwa_dsn, $db_user, $db_pass, { PrintError => 0, AutoCommit => 1, private_foo_cachekey => 'baruwa', RaiseError => 1, ShowErrorStatement => 1, pg_enable_utf8 => 1 } ) unless $conn && $conn->ping;
Added an external watcher process to address the BSQL process not being available.
The BaruwaSQL process starts up every few hours. However, when the connection to de backend database fails, there is no retry, and the process does not start. This means that until the next restart cycle, logging will go to backup, instead of the database. Please add a retry mechanism to the database connection sequence to make this more robust.