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

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Nov 27 10:13:41 MST 2013


On 02:58 pm, peter.westlake at pobox.com wrote:
>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.

Probably not.

There is some discussion on 
<https://twistedmatrix.com/trac/ticket/5941>.

Jean-Paul




More information about the Twisted-Python mailing list