[Twisted-Python] How Twisted is This?

Peter Hansen peter at engcorp.com
Wed Jul 16 10:12:28 MDT 2003


Matthias Urlichs wrote:
> 
> Hi, Brad Bollenbach wrote:
> 
> > I write a "monicron". monicron wakes up every five minutes and asks the
> > system "are there any monitors that need to be performed right now?" The
> > answer will either be "Yes, here's the monitors that need to be
> > performed right now" or "No".
> 
> Why don't you write a function that finds the earliest monitor job which
> needs to run next, and delay for exactly that amount?

One good reason to do the "every five minutes check" thing instead of
"wait exactly this long based on a precalculated value" thing is that
if the things to be monitored can be added or removed dynamically,
interrupting the sleep is more difficult than it's worth, while the 
blind periodic check is much simpler and more robust.

-Peter




More information about the Twisted-Python mailing list