mirror of https://gitee.com/bigwinds/arangodb
merge
This commit is contained in:
commit
2caa3b7a60
|
@ -196,7 +196,7 @@ namespace triagens {
|
||||||
else {
|
else {
|
||||||
executeBatchRequest(numOps);
|
executeBatchRequest(numOps);
|
||||||
}
|
}
|
||||||
_operationsCounter->done(_batchSize);
|
_operationsCounter->done(_batchSize > 0 ? _batchSize : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,6 +367,7 @@ int main (int argc, char* argv[]) {
|
||||||
usleep(5000);
|
usleep(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (Delay) {
|
if (Delay) {
|
||||||
Status("sleeping (startup delay)...");
|
Status("sleeping (startup delay)...");
|
||||||
sleep(10);
|
sleep(10);
|
||||||
|
@ -453,7 +454,7 @@ int main (int argc, char* argv[]) {
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
arangobExitFunction(ret, NULL);
|
arangobExitFunction(ret, nullptr);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1341,6 +1341,78 @@
|
||||||
// --SECTION-- public printing functions
|
// --SECTION-- public printing functions
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief flatten
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
var hasOwnProperty = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
||||||
|
|
||||||
|
exports.flatten = function (obj, seen) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj instanceof Date) {
|
||||||
|
return obj.toJSON();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!seen) {
|
||||||
|
seen = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Object.create(null),
|
||||||
|
src = obj,
|
||||||
|
keys,
|
||||||
|
i,
|
||||||
|
key,
|
||||||
|
val;
|
||||||
|
|
||||||
|
if (typeof obj === 'function') {
|
||||||
|
result.__exec = String(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (src) {
|
||||||
|
if (
|
||||||
|
seen.indexOf(src) !== -1
|
||||||
|
|| (obj.constructor && src === obj.constructor.prototype)
|
||||||
|
) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
seen.push(src);
|
||||||
|
keys = Object.getOwnPropertyNames(src);
|
||||||
|
for (i = 0; i < keys.length; i++) {
|
||||||
|
key = keys[i];
|
||||||
|
if (typeof src !== 'function' || (
|
||||||
|
key !== 'arguments' && key !== 'caller' && key !== 'callee'
|
||||||
|
)) {
|
||||||
|
if (key.charAt(0) !== '_' && !hasOwnProperty(result, key)) {
|
||||||
|
val = obj[key];
|
||||||
|
if (seen.indexOf(val) !== -1 && (
|
||||||
|
typeof val === 'object' || typeof val === 'function'
|
||||||
|
)) {
|
||||||
|
result[key] = '[Circular]';
|
||||||
|
} else {
|
||||||
|
result[key] = exports.flatten(val, seen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
src = Object.getPrototypeOf(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj.constructor && obj.constructor.name) {
|
||||||
|
if (obj instanceof Error && obj.name === Error.name) {
|
||||||
|
result.name = obj.constructor.name;
|
||||||
|
} else if (!hasOwnProperty(result, 'constructor')) {
|
||||||
|
result.constructor = {name: obj.constructor.name};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/// @brief inspect
|
/// @brief inspect
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1561,6 +1633,28 @@
|
||||||
useColor = false;
|
useColor = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// --SECTION-- public utility functions
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// @brief exponentialBackoff
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
exports.exponentialBackOff = function (n, i) {
|
||||||
|
'use strict';
|
||||||
|
if (i === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (n === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (n === 1) {
|
||||||
|
return Math.random() < 0.5 ? 0 : i;
|
||||||
|
}
|
||||||
|
return Math.floor(Math.random() * (n + 1)) * i;
|
||||||
|
};
|
||||||
|
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue