[Mimedefang] mysql problem
Torsten Vielhak
Torsten.Vielhak at nordac.com
Tue Aug 5 10:11:02 EDT 2003
Hi,
> I have a sub routine called should_check_for_spam ($). This either
returns a 1 or a 0. 1 means filter will check for spam 0 means
> its disabled. In my test environment everything works fine. However when
I implement it in higher volume production box, it seems
> to retain the variables from the database in memory. I have tried to do a
$sth->finish; and $dbh->disconnect. Below is a copy of
> the subroutine. Any help or ideas is very appreciated.
I have just the same problem. The problem is IMHO that the
Mail::SpamAssassin object
is only initiated once and all configs (e.g. whitelist_from) are merged to
the object.
Unfortunaly there is no method "init_config" or "reread_config".
For me a VERY VERY dirty hack works (beware of using sql preferences which
are not
resetted via $object->{conf}->...):
sub spam_assassin_status (;$) {
my $object = spam_assassin_init(@_);
return undef unless $object;
# ===== changed by tv, 24.07.03
# set config to default (clear old per-user configs and set default
# if DB failes (this config also is used if more than one recipient)
$object->{conf}->{whitelist_from} = { };
$object->{conf}->{required_hits} = 5.0;
# ===== only one recipient => load preferences per sql
if ($#Recipients == 0) {
$object->load_scoreonly_sql("$Recipients[0]");
md_syslog('info', "Load scores for $Recipients[0]");
}
# ===== changed by tv, end
[....]
cheers,
Torsten
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: InterScan_Disclaimer.txt
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20030805/7e85e87e/attachment.txt>
More information about the MIMEDefang
mailing list