Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
jio
Commits
c9a368e5
Commit
c9a368e5
authored
Apr 07, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default timeout set to infinity (0)
parent
86e1969d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
53 deletions
+18
-53
src/jio/features/jobRecovery.js
src/jio/features/jobRecovery.js
+3
-2
src/jio/features/jobTimeout.js
src/jio/features/jobTimeout.js
+4
-3
test/jio/tests.js
test/jio/tests.js
+11
-48
No files found.
src/jio/features/jobRecovery.js
View file @
c9a368e5
...
@@ -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
=
1
0000
;
recovery_delay
=
9
0000
;
}
}
if
(
options
.
job_management
!==
false
&&
options
.
job_recovery
!==
false
)
{
if
(
options
.
job_management
!==
false
&&
options
.
job_recovery
!==
false
)
{
...
...
src/jio/features/jobTimeout.js
View file @
c9a368e5
...
@@ -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
,
1000
0
);
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
...
...
test/jio/tests.js
View file @
c9a368e5
...
@@ -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
"
:
1000
0
,
"
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
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment