Python SDK with Couchbase 1.8.1: broken pipe error after connection idles for a while
Hello everyone,
I'm using Couchbase 1.8.1 and version 0.7.2 of the python client and I've encountered a minor problem.
I have a server written using the twisted library for python and I'm using couchbase as the database. A connection to couchbase is established using the unified client (couchbase.Couchbase) when the server starts up. The problem occurs when I let the server idle for awhile (maybe 10-20 minutes?). When I try to get a value from the database after idling for awhile, I get a socket.error from python and a broken pipe. This causes the database query to hang for 30 seconds before it finally returns the value. Queries work fine again after that, until I let it idle again, of course.
Any idea how I can resolve this issue?
I've tried establishing a new connection for each query but that causes a pretty substantial delay.
Is there a way to check if the connection is working before attempting a query?
Should I schedule a function that just queries the database every minute or so to make sure the connection stays a live?
Any help would be appreciated!
Thanks!