EndCustomFunctions when the batch finish

Alvaro Marin alvaro at hostalia.com
Thu Mar 3 13:50:35 GMT 2011


I've a CustomFunction to insert messages into a database. The plugin is 

sub InitDBPlug {
	$dbh = DBI->connect("DBI:mysql:database=...

sub DBPlug {
	$sth = $dbh->prepare("INSERT INTO...

sub EndDBPlug {

The problem is that as I see in bin/Mailscanner, the End functions of 
the "plugins" are called (with 
MailScanner::Config::EndCustomFunctions()) only when the child has to be 
restarted by "restartevery" variable:

(time>=$StartTime && time<$RestartTime && !$BayesRebuild)

The default value for "Restart Every" is 7200, so the MySQL connection 
is kept open until that time without any use.

So, Can I add safely :

   # Close down all the user's custom functions

inside that "while" to be executed every time that a Batch finish to 
close the DB connection?

Thank you!


Alvaro Marín Illera
Hostalia Internet

More information about the MailScanner mailing list