[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 --------------
Important Note 
This email and any attachment hereto are confidential and may contain trade secrets or may be otherwise protected from disclosure. If you have received it in error you are in 
notice of this fact. Please notify us immediately by reply email and then delete this email and any attachment from your system. Please understand that you are not allowed to 
copy this email or any attachment hereto or disclose its contents to any other person. Thank you.

Wichtiger Hinweis 
Diese E-Mail und etwaige Anlagen koennen Betriebs- oder Geschaeftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtuemlich erhalten
haben, ist Ihnen dieser Umstand hiermit bekannt. Bitte benachrichtigen Sie uns in diesem Fall umgehend durch Ruecksendung der E-Mail und loeschen Sie diese E-Mail einschließ-
lich etwaiger Anlagen von Ihrem System. Diese E-Mail und ihre Anlagen duerfen weiterhin nicht kopiert oder an Dritte weitergegeben werden. Vielen Dank.


More information about the MIMEDefang mailing list