jacob
November 22, 2016, 11:51pm
1
I am trying to extend the timeout of my N1QL query and am following the following link:
http://pythonhosted.org/couchbase/api/n1ql.html#couchbase.n1ql.N1QLQuery.timeout
I have added the following to my Pythoncode (bucket is a Bucket object):
from couchbase.n1ql import N1QLQuery
...
bucket.n1ql_timeout = 3600
N1QLQuery.timeout = 3600
However, even though I set this, the query still seems to timeout after 1m15s.
Is there something that Im missing?
Thanks.
From your link, I see couchbase.bucket.Bucket.n1ql_timeout
Is your setting scoped properly?
How is the timeout happening? is it happening only on the client side, or is the server terminating the query after 75s. Post an example log (and exception message)
jacob
November 23, 2016, 2:41pm
4
The server is terminating the query after 75s. Below is the error message I get to my browser (running a flask app):
raise N1QLError.pyexc('N1QL Execution failed', err)
couchbase.n1ql.N1QLError: <N1QL Execution failed, OBJ={'msg': 'Timeout 1m15s exceeded', 'code': 4080}>
So this appears to be the server timing out, and not the client. So it seems that your settings have at least partially taken effect.
From what I’ve observed, the client should be encoding and sending the correct timeout parameters:
from couchbase.bucket import Bucket
from couchbase.n1ql import N1QLQuery
cb = Bucket('couchbase://localhost/default')
cb.n1ql_timeout = 3600
query = N1QLQuery('SELECT 1')
query.timeout = 3600
cb.n1ql_query(query).execute()
produces (according to Wireshark):
{"timeout": "3600.0s"}
Can you check if your app sets these things accordingly?
jacob
November 23, 2016, 6:01pm
6
Looks like the line:
query.timeout = 3600
fixed my issue. Before, I just had N1QLQuery.timeout = 3600
Thank you.