[Twisted-Python] Could Service.startService return a Deferred?

Peter Westlake peter.westlake at pobox.com
Wed Nov 27 07:58:30 MST 2013


I have a Twisted application with several Services. One of them has a
startService method that does some setup asynchronously. This can go
wrong if the next service to start makes a call to the first one, and it
isn't ready yet. One way round it would be to make all methods on the
slow service returned a Deferred (e.g.
"self.slow_init.addCallback(self.actual_method)", but it seems a shame
to have to do that every time when the situation only occurs when the
daemon starts up. So would it be possible for t.a.s.Service.startService
to be allowed to return a Deferred? Then the next service would only be
started up when the Deferred fired.

Peter.



More information about the Twisted-Python mailing list