[Twisted-web] Xml-Rpc server troubles
Andrea Nicolini
andrea at teamsw.it
Wed Nov 17 00:39:07 MST 2004
On 11/16/04 22:35:50, Eric Mangold wrote:
> Where is your Errback? If this doesn't work then you'll never know
> until
> the Deferred gets GC'ed, if it ever does, and even then only
> sometimes.
>
> Deferred's have __del__ defined to hopefully, maybe, warn the user if
> there
> were errors that never got handled. This is of course not guarenteed
> to happen.
>
> Always, always, add Errbacks.
Ok, you're right. I'll do.
>
> I don't know much about Twisted's RDBMS stuff. I'm assuming
> createjob gets run in a thread.
> Maybe these threads are getting stuck? *shrug*. Apparently the
> Deferred's aren't firing, but you
> could have a timeout function to see if they really are getting fired
> but lost before the
> result gets send back by xml-rpc.
>
> Perhaps something like this (untested):
>
> def xmlrpc_createjob(self,hash):
> tscmfuncs.call_debug(debug,foreground)
> d = self.dbpool.runInteraction(self.createjob,hash)
> reactor.callLater(5, checkIfDeferredFired, d)
> return d.addCallback(self.returnData)
>
> def checkIfDeferredFired(d):
> if not d.called:
> log.msg('Deferred not fired after 5 seconds')
>
> #omit this if it will fill your logs too much
> else:
> log.msg('Deferred fired OK')
>
Thank you very much Eric.
I'll follow your advices.
--
Andrea Nicolini
mailto:andrea at teamsw.it
im:aser76 at jabber.linux.it
http://www.teamsw.it
Team Software S.r.l.
Via Campagna 30
Cognento MO
Tel 059.343790
More information about the Twisted-web
mailing list