[Twisted-Python] How Twisted is This?

Bob Ippolito bob at redivi.com
Wed Jul 16 10:40:51 MDT 2003


On Wednesday, Jul 16, 2003, at 12:12 America/New_York, Peter Hansen 
wrote:

> 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.

I don't necessarily agree with that.  With the "every five minutes 
check" you have to write your own callLater mechanism, when you let 
tasks schedule themselves, you don't.  Also with the "every five 
minutes check" you're using computer+bandwidth resources in a much less 
sane manner, it sure as hell isn't going to scale awfully well.

-bob





More information about the Twisted-Python mailing list