In article <[EMAIL PROTECTED]>, Fredrik Lundh <[EMAIL PROTECTED]> wrote: >Martin DeMello wrote: >> >> In the interests of not hammering the db unnecessarily, I'm >> considering the following >> 1. A series of independent "monitor" threads that collect information >> over TCP from the cluster of machines, and write it to a queue >> 2. A "logger" thread that empties the queue every second or so and >> inserts the collected information to the db via a single insert >> statement > >why are you using a queue for this case, btw? why not just use a plain list > > L = [] > lock = threading.Lock() > >and add stuff using append in the monitor threads > > with lock: > L.append(item)
Because using a queue requires less thinking. I certainly would use a queue in this case instead of rolling my own. -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "Argue for your limitations, and sure enough they're yours." --Richard Bach -- http://mail.python.org/mailman/listinfo/python-list