Best way to implement a timed queue?
usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Jan 4 17:35:01 CET 2007
Thomas Ploch wrote:
> I am having troubles with implementing a timed queue. I am using
> the 'Queue' module to manage several queues. But I want a timed
> access, i.e. only 2 fetches per second max. I am horribly stuck on
> even how I actually could write it. Has somebody done that before?
> And when yes, how is the best way to implement it?
If you use an event loop system you could derive a class from your
queue class whose "pop" method only returns an element if some
timer has run out. After the maximum number of fetches you'd have
to reset the timer.
BOFH excuse #327:
The POP server is out of Coke
More information about the Python-list