You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Justin Mason <jm...@jmason.org> on 2005/03/14 19:53:49 UTC

Re: plugins and parrallelization

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Eric A. Hall writes:
> On 3/14/2005 12:32 PM, Daryl C. W. O'Shea wrote:
> 
> > There's no need to do your lookups more than once.  Save the results the 
> > first time you do the lookups/processing.
> > 
> > See the SPF.pm plugin for a good example.
> 
> Oh right, it's persistent. Duh.

yeah -- as discussed in the Plugin pod docs, the life-cycle of the objects
you have access to there is:

    - PerMsgStatus object: persistent throughout a single message's
      scanning, so good for this case.

    - Conf object: global and always available, so good for permanent
      state.  not good for state that may change between users though; to
      deal with that, use the signal_user_changed() hook if necessary.

Those are the two main places to store data if needed.

- --j.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFCNd29MJF5cimLx9ARAvRSAJ41g19rPg9NmR4s0i/4120zXZumbwCeNPw9
oCrvOJPfGYJ7na6TeITSYbU=
=SaR5
-----END PGP SIGNATURE-----


Re: plugins and parrallelization

Posted by "Eric A. Hall" <eh...@ehsco.com>.
Eric A. Hall wrote:

> I'm storing the session variables (such as login status) as part of $self,
> and storing message variables with $permsgstatus. But where do I put the
> logout/disconnect code? DESTROY seems to get called after every message
> ("seems to" but I'm fairly blurry at this point), which causes the session
> to get killed after every message. Where am I supposed to put this stuff?

Got around to looking at this some more. DESTROY() does actually get
called when everything is being zapped, but that is way too late to do
anything useful (Net::LDAP is already dead, for example).

http://spamassassin.apache.org/full/3.0.x/dist/doc/Mail_SpamAssassin_Plugin.html
says "$plugin->finish() called when the Mail::SpamAssassin object is
destroyed" but that is wrong or there is a bug because near as I can tell
finish() never gets called, and it doesn't appear to even get probed (as
opposed to $plugin->parse_config which shows up in debug probes, and even
gets called). Is this a bug?

Frankly I'm not sure that finish() would work, since the description
sounds like it happens the same time as DESTROY() which is no different.
What would be really useful here would be something that SA calls after it
is done hitting all of the rules that it's going to. That probably ought
to be finish(), and maybe it is, dunno.

I can post this on bugzilla so it can be ignored there too. :o

-- 
Eric A. Hall                                        http://www.ehsco.com/
Internet Core Protocols          http://www.oreilly.com/catalog/coreprot/

Re: plugins and parrallelization

Posted by "Eric A. Hall" <eh...@ehsco.com>.
Justin Mason wrote:

> yeah -- as discussed in the Plugin pod docs, the life-cycle of the objects
> you have access to there is:

I'm currently trying to work this so the LDAP session is maintained for
the lifetime of the module. TCP sessions are pretty expensive, and having
hundreds or even thousands of dead sessions lying around in timeout mode
(not uncommon for busy sites) is going to be very undesirable.

I'm storing the session variables (such as login status) as part of $self,
and storing message variables with $permsgstatus. But where do I put the
logout/disconnect code? DESTROY seems to get called after every message
("seems to" but I'm fairly blurry at this point), which causes the session
to get killed after every message. Where am I supposed to put this stuff?

Thanks

-- 
Eric A. Hall                                        http://www.ehsco.com/
Internet Core Protocols          http://www.oreilly.com/catalog/coreprot/