[Tutor] Python performance resources & resouce usage hints
Kent Johnson
kent37 at tds.net
Fri Apr 7 19:53:38 CEST 2006
Hugo González Monteverde wrote:
> You are not using the optional timeout and blocking which 'get' provides (!)
>
> Try setting it and see your CPU usage go down. This will implement
> blocking, and the queue will be used as soon as data is there. Set block
> to True and a timeout if you need to use it (looks like you only need
> blocking)
>
> while True:
> try:
> data = self.queue.get(True)
> self.DAO.send_data(data)
I think he will need the timeout too, otherwise the shutdown flag will
only be checked when there is work which is probably not what he wants.
I agree, this is a good solution.
Kent
More information about the Tutor
mailing list