On Wed, 2007-07-25 at 10:38 -0400, Daniel Miller wrote:
Is this such a stupid question that it doesn't even warrant a response?
Not really, but it's a more complex question than it first seems, and you're trying very hard to reproduce things that already exist. First question: why is your PB server allocating "request IDs" and storing hashes of them. You could just return a pb.Referenceable to the client, backed by a normal python object (with a normal object lifecycle) on the server. Regarding the retry mechanism: It looks to me like you're treating PB like an RPC mechanism, and finding that the nature of networks (they fail, unpredictably) is tripping you up. Try thinking of it in a more message-oriented way. I would implement it something like this, using the python2.5 yield and inlineCallbacks functionality: class MyResources: def render_POST(self, request): d = self.doOnlyOnce(request) d.addCallbacks(self.done, self.failed, (request,), (request,)) return server.NOT_DONE_YET def done(self, data, request): request.write(data) request.finish() def failed(self, f, request): request.write("An error occured") request.write(f.getErrorMessage()) reqeust.finish() @inlineCallbacks def doOnlyOnce(self, request): pbroot = yield self.pbclifactory.getRootObject() theobject = yield pbroot.callRemote('makeRequest') data = yield theobject.callRemote('someMethod', request.args) # some local code here, then... # ok, done, tell the remote object to "commit" (finalise, delete) yield theobject.callRemote('commit') returnValue(data) Your example is a bit theoretical, so it's difficult to see if this would work for you.