[Twisted-Python] [Twisted-web] Question regarding callLater() and service creation

Andrew Bennetts andrew at bemusement.org
Thu Mar 10 06:43:47 EST 2011


This thread belongs on the twisted-python@ list, rather than
twisted-web@, as it has nothing to do with twisted.web.

Eric Chamberlain wrote:
> I'm creating a service using Twisted.  It has nothing to do with
> networking (I know that Twisted is an event-driven networking
> engine... stay with me here :).  It's simply polling a database every
> 30 seconds.  I'm using callLater() once the work has been completed.
> My question is does the reactor spawn a new thread once the
> callLater() timeout has been reached?  If so, this would mean that the
> work being done may be effected by the GIL, correct?

Incorrect.  callLater spawns no threads.

There's nothing wrong or even particularly strange with using Twisted
for projects unrelated to networking.  An event loop with good
facilities for spawning and interacting with subprocesses and calling
functions at certain times has plenty of uses, even if you don't also
need the capacity to handle network IO.

That doesn't mean that Twisted is necessarily the best tool for your
task, but I wouldn't rule it out automatically either.

-Andrew.




More information about the Twisted-Python mailing list