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) { ...@@ -43,9 +43,10 @@ function enableJobRecovery(jio, shared, options) {
var i, job_array, delay, deadline, recovery_delay; 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) { if (recovery_delay < 0) {
recovery_delay = 10000; recovery_delay = 90000;
} }
if (options.job_management !== false && options.job_recovery !== false) { if (options.job_management !== false && options.job_recovery !== false) {
......
...@@ -25,8 +25,8 @@ function enableJobTimeout(jio, shared, options) { ...@@ -25,8 +25,8 @@ function enableJobTimeout(jio, shared, options) {
number : default_value); number : default_value);
} }
// 10 seconds by default // Infinity by default
var default_timeout = positiveNumberOrDefault(options.default_timeout, 10000); var default_timeout = positiveNumberOrDefault(options.default_timeout, 0);
function timeoutReject(param) { function timeoutReject(param) {
return function () { return function () {
...@@ -41,7 +41,8 @@ function enableJobTimeout(jio, shared, options) { ...@@ -41,7 +41,8 @@ function enableJobTimeout(jio, shared, options) {
} }
function initJob(job) { 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.timeout = positiveNumberOrDefault(
job.options.timeout, job.options.timeout,
default_timeout default_timeout
......
...@@ -82,54 +82,13 @@ ...@@ -82,54 +82,13 @@
module('JIO timeout'); 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 () { test('should fail after storage inactivity timeout', 2, function () {
var i, called = false, jio = new JIO({ var i, called = false, jio = new JIO({
"type": "fake", "type": "fake",
"id": "2 No Respons" "id": "2 No Respons"
}, { }, {
"workspace": {} "workspace": {},
"default_timeout": 10000
}); });
stop(); stop();
...@@ -742,7 +701,7 @@ ...@@ -742,7 +701,7 @@
"state": "ready", // deferred writing "running" "state": "ready", // deferred writing "running"
//"modified": new Date(), //"modified": new Date(),
"max_retry": 2, "max_retry": 2,
"timeout": 10000, "timeout": 0,
"id": 2 "id": 2
}; };
...@@ -788,7 +747,8 @@ ...@@ -788,7 +747,8 @@
"type": "fake", "type": "fake",
"id": "Job Recove" "id": "Job Recove"
}, { }, {
"workspace": workspace "workspace": workspace,
"default_timeout": 10000
}); });
stop(); stop();
...@@ -804,7 +764,8 @@ ...@@ -804,7 +764,8 @@
"type": "fake", "type": "fake",
"id": "Job Recove" "id": "Job Recove"
}, { }, {
"workspace": workspace "workspace": workspace,
"recovery_delay": 10000
}); });
setTimeout(function () { setTimeout(function () {
...@@ -839,7 +800,8 @@ ...@@ -839,7 +800,8 @@
"type": "fake", "type": "fake",
"id": "Job Recovw" "id": "Job Recovw"
}, { }, {
"workspace": workspace "workspace": workspace,
"default_timeout": 10000
}); });
stop(); stop();
...@@ -863,7 +825,8 @@ ...@@ -863,7 +825,8 @@
"type": "fake", "type": "fake",
"id": "Job Recovw" "id": "Job Recovw"
}, { }, {
"workspace": workspace "workspace": workspace,
"recovery_delay": 10000
}); });
setTimeout(function () { 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