ArangoDB Cursor Timeout

2019-08-15 09:36发布

问题:

Using ArangoDB 2.3.1. It seems my cursors are expiring within a couple minutes. I would like them to last for an hour. I've set up my AQL query object with the TTL parameter as follows:

{
    "query": 'removed actual query',
    "count": true,
    "batchSize": 5,
    "ttl": 3600000
}

My understanding is that the TTL parameter should tell the server to keep the server for 3600000 milliseconds or 1 hour. But it expires within about 60 seconds. In fact, I've tried changing the TTL to several different numbers and it doesn't seem to do anything. Any ideas?

UPDATE: the actual error I receive from arango is "cursor not found"

回答1:

All of you are right. But I think it is a bug in 2.3:

--- a/arangod/V8Server/v8-vocbase.cpp
+++ b/arangod/V8Server/v8-vocbase.cpp
@@ -1216,13 +1216,13 @@ static v8::Handle<v8::Value> JS_ExecuteAql (v8::Arguments const& argv) {

     optionName = v8::String::New("ttl");
     if (argValue->Has(optionName)) {
-      ttl = TRI_ObjectToBoolean(argValue->Get(optionName));
+      ttl = TRI_ObjectToDouble(argValue->Get(optionName));
       ttl = (ttl <= 0.0 ? 30.0 : ttl);
     }

ttl is a double and so it should be casted to a double, not a bool. Unfortunately, assigning a bool to a double is valid in C++ so the compiler hasn't complained.



回答2:

Have you tried using the timeout directive?

--server.keep-alive-timeout=X

Where X is in seconds.

Or you can insert this into your arangod.conf file under the server section as

keep-alive-timout=X

According to the manual

Allows to specify the timout for HTTP keep-alive connections. The timeout value must be in seconds. Idle keep-alive connections will be closed by the server automatically when the timeout is reached.