From 3ca2e93e707adae469af23c9384863fc35957d1d Mon Sep 17 00:00:00 2001 From: Jan Hecking Date: Mon, 24 Jul 2017 09:53:36 +0800 Subject: [PATCH] Add socket timeout to query policy Resolves #207 --- lib/client.js | 26 +++++++++++++++++++------- src/main/policy.cc | 3 +++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/client.js b/lib/client.js index 7866b2ac..f88461ec 100644 --- a/lib/client.js +++ b/lib/client.js @@ -1871,12 +1871,19 @@ Client.prototype.updateLogging = function (logConfig) { * * A policy affecting the behavior of scan operations. * - * @property {number} timeout - Maximum time in milliseconds to wait for the operation to complete. - * @property {boolean} failOnClusterChange - Abort the scan if the cluster is not in a stable state. - * @property {boolean} [durableDelete=false] - Specifies whether a {@link - * http://www.aerospike.com/docs/guide/durable_deletes.html|tombstone} should - * be written in place of a record that gets deleted as a result of this - * operation. + * @property {number} [timeout=0] - Maximum time in milliseconds to wait for + * the operation to complete. The default (0) means do not apply a total + * timeout. + * @property {number} [socketTimeout=1000] - Maximum socket idle time in + * milliseconds when processing a database command. Zero means do not apply a + * socket idle timeout. + * @property {boolean} [failOnClusterChange=false] - Abort the scan if the + * cluster is not in a stable state. + * @property {boolean} [durableDelete=false] - If the scan runs a UDF which + * results in a record deletion, leave a {@link + * http://www.aerospike.com/docs/guide/durable_deletes.html|tombstone} for the + * record. This prevents deleted records from reappearing after node failures. + * Valid for Aerospike Server Enterprise Edition only. */ /** @@ -1884,7 +1891,12 @@ Client.prototype.updateLogging = function (logConfig) { * * A policy affecting the behavior of query operations. * - * @property {number} timeout - Maximum time in milliseconds to wait for the operation to complete. + * @property {number} [timeout=0] - Maximum time in milliseconds to wait for + * the operation to complete. The default (0) means do not apply a total + * timeout. + * @property {number} [socketTimeout=1000] - Maximum socket idle time in + * milliseconds when processing a database command. Zero means do not apply a + * socket idle timeout. */ /** diff --git a/src/main/policy.cc b/src/main/policy.cc index 7eb070ee..0065a4ac 100644 --- a/src/main/policy.cc +++ b/src/main/policy.cc @@ -236,6 +236,9 @@ int querypolicy_from_jsobject(as_policy_query* policy, Local obj, const if ((rc = get_optional_uint32_property(&policy->timeout, NULL, obj, "timeout", log)) != AS_NODE_PARAM_OK) { return rc; } + if ((rc = get_optional_uint32_property(&policy->socket_timeout, NULL, obj, "socketTimeout", log)) != AS_NODE_PARAM_OK) { + return rc; + } as_v8_detail( log, "Parsing query policy : success"); return AS_NODE_PARAM_OK; }