[Twisted-Python] twisted threading with a long running process

Doug Farrell dfarrell at mypublisher.com
Fri Jun 27 09:46:05 MDT 2008


Hi all,

 

I've built a Twisted server that handles Python logging messages sent
from the logging.handlers.SocketHandler system. Right now my protocol
implementation handles logging the received logRecord to a file and
entering it into an in memory model for statistical purposes. I'm
thinking of off-loading this activity to a separate thread by having the
protocol just send the logRecord it receives into queue that is serviced
by a separate thread. My question is whether using the
twisted.internet.threads.deferToThread() method is a good way to kick
off this other thread. The other thread will be running for as long as
the Twisted server runs so it can handle logRecords in the queue. Would
just starting a threading.Thread based class be a better solution,
giving access to queue inside the class to the protocol?

 

Thanks,

Doug

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20080627/a81c7242/attachment.html>


More information about the Twisted-Python mailing list