Commit c9a368e5 authored by Tristan Cavelier's avatar Tristan Cavelier

default timeout set to infinity (0)

parent 86e1969d
......@@ -43,9 +43,10 @@ function enableJobRecovery(jio, shared, options) {
var i, job_array, delay, deadline, recovery_delay;
recovery_delay = numberOrDefault(options.recovery_delay, 10000);
// 1 m 30 s === default firefox request timeout
recovery_delay = numberOrDefault(options.recovery_delay, 90000);
if (recovery_delay < 0) {
recovery_delay = 10000;
recovery_delay = 90000;
}
if (options.job_management !== false && options.job_recovery !== false) {
......
......@@ -25,8 +25,8 @@ function enableJobTimeout(jio, shared, options) {
number : default_value);
}
// 10 seconds by default
var default_timeout = positiveNumberOrDefault(options.default_timeout, 10000);
// Infinity by default
var default_timeout = positiveNumberOrDefault(options.default_timeout, 0);
function timeoutReject(param) {
return function () {
......@@ -41,7 +41,8 @@ function enableJobTimeout(jio, shared, options) {
}
function initJob(job) {
if (typeof job.timeout !== 'number' || job.timeout < 0) {
if (typeof job.timeout !== 'number' || !isFinite(job.timeout) ||
job.timeout < 0) {
job.timeout = positiveNumberOrDefault(
job.options.timeout,
default_timeout
......
......@@ -82,54 +82,13 @@
module('JIO timeout');
test('should fail after default command timeout', 2, function () {
var i, called = false, jio = new JIO({
"type": "fake",
"id": "1 No Respons"
}, {
"workspace": {}
});
stop();
jio.post({}).always(function (answer) {
var message = (answer && answer.message) || "Timeout";
called = true;
if (i !== undefined) {
start();
clearTimeout(i);
}
delete answer.message;
deepEqual(answer, {
"error": "request_timeout",
"method": "post",
"result": "error",
"reason": "timeout",
"status": 408,
"statusText": "Request Timeout"
}, message);
});
setTimeout(function () {
ok(!called, "callback " + (called ? "" : "not") + " called");
}, 9999);
setTimeout(function () {
commands['1 No Respons/post'].free();
}, 100);
i = setTimeout(function () {
i = undefined;
start();
ok(false, "No response");
}, 11000);
});
test('should fail after storage inactivity timeout', 2, function () {
var i, called = false, jio = new JIO({
"type": "fake",
"id": "2 No Respons"
}, {
"workspace": {}
"workspace": {},
"default_timeout": 10000
});
stop();
......@@ -742,7 +701,7 @@
"state": "ready", // deferred writing "running"
//"modified": new Date(),
"max_retry": 2,
"timeout": 10000,
"timeout": 0,
"id": 2
};
......@@ -788,7 +747,8 @@
"type": "fake",
"id": "Job Recove"
}, {
"workspace": workspace
"workspace": workspace,
"default_timeout": 10000
});
stop();
......@@ -804,7 +764,8 @@
"type": "fake",
"id": "Job Recove"
}, {
"workspace": workspace
"workspace": workspace,
"recovery_delay": 10000
});
setTimeout(function () {
......@@ -839,7 +800,8 @@
"type": "fake",
"id": "Job Recovw"
}, {
"workspace": workspace
"workspace": workspace,
"default_timeout": 10000
});
stop();
......@@ -863,7 +825,8 @@
"type": "fake",
"id": "Job Recovw"
}, {
"workspace": workspace
"workspace": workspace,
"recovery_delay": 10000
});
setTimeout(function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment