1
0
Fork 0
This commit is contained in:
Heiko Kernbach 2014-08-01 20:20:15 +02:00
commit 2caa3b7a60
3 changed files with 97 additions and 2 deletions

View File

@ -196,7 +196,7 @@ namespace triagens {
else {
executeBatchRequest(numOps);
}
_operationsCounter->done(_batchSize);
_operationsCounter->done(_batchSize > 0 ? _batchSize : 1);
}
}

View File

@ -367,6 +367,7 @@ int main (int argc, char* argv[]) {
usleep(5000);
}
if (Delay) {
Status("sleeping (startup delay)...");
sleep(10);
@ -453,7 +454,7 @@ int main (int argc, char* argv[]) {
ret = EXIT_FAILURE;
}
arangobExitFunction(ret, NULL);
arangobExitFunction(ret, nullptr);
return ret;
}

View File

@ -1341,6 +1341,78 @@
// --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
////////////////////////////////////////////////////////////////////////////////
@ -1561,6 +1633,28 @@
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;
};
}());
// -----------------------------------------------------------------------------