File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/Engine/Convert/Resources Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ system = require('system'),
32
32
address , output , size ;
33
33
34
34
// Reference: https://stackoverflow.com/questions/16854788/phantomjs-webpage-timeout
35
- // Add resource timeout to avoid a permanent hang.
36
- page . settings . resourceTimeout = 10000 ; // ms
35
+ // Add resource timeout to avoid a permanent hang. It applies to each individual resource.
36
+ page . settings . resourceTimeout = 5000 ; // ms
37
37
page . onResourceTimeout = function ( e ) {
38
38
console . log ( e . errorCode ) ; // it'll probably be 408
39
39
console . log ( e . errorString ) ; // it'll probably be 'Network timeout on resource'
@@ -74,6 +74,10 @@ if (system.args.length < 3 || system.args.length > 5) {
74
74
page . zoomFactor = system . args [ 4 ] ;
75
75
}
76
76
page . open ( address , function ( status ) {
77
+ window . setTimeout ( function ( ) {
78
+ console . log ( "Page took too long to load" ) ;
79
+ phantom . exit ( 1 ) ;
80
+ } , 10000 ) ;
77
81
if ( status !== 'success' ) {
78
82
console . log ( 'Unable to load the address!' ) ;
79
83
phantom . exit ( ) ;
You can’t perform that action at this time.
0 commit comments