Re: [Zope-dev] zope.sendmail RFC: start background thread on ProcessStarting event

2010-01-29 Thread Marius Gedminas
On Fri, Jan 29, 2010 at 08:00:12AM +0100, Fabio Tranchitella wrote:
> * 2010-01-28 15:56, Marius Gedminas wrote:
> > I recently came up with a different and perhaps a bit simpler solution:
> > 
> >   * make zope.sendmail not start the thread during ZCML processing,
> > instead make it listen for ProcessStarting events and start the
> > thread then.
> 
> I like your approach, as long as the console script is also provided to
> process the queue (as it is now in 3.8.0).

Oh, absolutely, the standalone script is a wonderful idea.

> In any way, to keep BBB, we should ensure that users of zope.sendmail will
> have the thread running by default, without changing their code.

Yesterday I tried to upgrade to zope.sendmail 3.7.1 in an app that's
currently based on Zope 3.4 KGS.  I had to give up after two hours of
fighting explicit and implicit compatibility problems and upgrading most
of the version pins.  The zope.component >= 3.8.0 requirement is deadly.

My motivation to have an alternative fix that could be backported to
something compatible with Zope 3.4 KGS is now much higher.

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


Re: [Zope-dev] zope.sendmail RFC: start background thread on ProcessStarting event

2010-01-28 Thread Fabio Tranchitella
* 2010-01-28 15:56, Marius Gedminas wrote:
> I recently came up with a different and perhaps a bit simpler solution:
> 
>   * make zope.sendmail not start the thread during ZCML processing,
> instead make it listen for ProcessStarting events and start the
> thread then.

I like your approach, as long as the console script is also provided to
process the queue (as it is now in 3.8.0).

In any way, to keep BBB, we should ensure that users of zope.sendmail will
have the thread running by default, without changing their code.

Thanks.

-- 
Fabio Tranchitella / Tranchitella Kft. http://tranchitella.eu
1024D/7F961564, fpr 5465 6E69 E559 6466 BF3D 9F01 2BF8 EE2B 7F96 1564
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )


[Zope-dev] zope.sendmail RFC: start background thread on ProcessStarting event

2010-01-28 Thread Marius Gedminas
zope.sendmail has this nasty habit of starting a background thread
during ZCML conguration, if your ZCML contains a 
directive.  This is Very Bad(TM) if you use things like debugzope, since
you end up with two processes watching your mail queue, which can easily
result in duplicate emails getting sent.

Fabio Tranchitella recently released zope.sendmail 3.8.0 which fixes the
problem in the following way:

  * you edit  and set processorThread="false" to
suppress that thread

  * you edit your init.d scripts and start a new daemon (zope-sendmail)
to watch the queue

I recently came up with a different and perhaps a bit simpler solution:

  * make zope.sendmail not start the thread during ZCML processing,
instead make it listen for ProcessStarting events and start the
thread then.

It would have the following advantages:

  * it would make the _default_ configuration of zope.sendmail (which
is processorThread=true for BBB reasons) not quite as broken as it
is now

  * simpler administration: no need to figure out what new daemon you
need to start and how to do that.

  * it could be backported to older zope.sendmail bugfix releases (e.g.
3.5.2).

and the following disadvantages:

  * it's a kinda redundant solution for the same problem

  * ProcessStarting is not necessarily emitted on Zope startup, e.g. I
think it's not used if you deploy a Zope-3-based WSGI app

What do other people think?

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )