On Sep 4, 1:51 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Martin DeMello wrote:
> > I'm writing a cluster monitor, that collects information from a set of
> > machines and logs it to a database
>
> > 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()

Good point - I thought of queue because it was self-locking, but
you're right, I can as well use a simple list and lock it myself.

martin
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to