[Xapian-discuss] Re: Remote databases and daemons, corrected
Michel Pelletier
michel at dialnetwork.com
Mon Mar 27 09:23:05 BST 2006
So much for posting raw code, there is a bit of a silly error in that
code, the deferred callback must put the connection back into the pool
instead of immediately in remote_query.
Here's one that's a bit more verbose but gets the job done, but then
again I'll have to do some more testing. I should have known when
threads and then twisted on top of that get involved, it takes some
thought ;)
def remote_query(self, query):
def _query(d, q):
return d, xaql.query_xapwrap(d, q)
def _return((d, q)):
self.readers.put(d)
return q
return threads.deferToThread(_query, self.readers.get(),
query).addCallback(_return)
More information about the Xapian-discuss
mailing list