Skip to content

Commit 9d4b5ed

Browse files
committed
Fix timeout. It was set to 12s instead of 2min,
document timeout behaviour
1 parent 2c41416 commit 9d4b5ed

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

lib/scripts/pdf_a4_portrait.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scripts/pdf_a4_portrait.coffee

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ page.onError = (msg, trace) ->
3838

3939

4040
# Force cleanup after 2 minutes
41-
timeout = timeout+2000 if timeout = json.options.timeout
41+
# Add 2 seconds to make sure master process triggers kill
42+
# before to the phantom process
43+
timeout = (options.timeout || 120000) + 2000
4244
setTimeout ->
4345
exit('Force timeout')
44-
, timeout || 12000
46+
, timeout
4547

4648

4749
# Returns a hash of HTML content
4850
# ------------------------------
49-
getContent = () ->
51+
getContent = ->
5052
page.evaluate ->
5153
styles = document.querySelectorAll('link,style')
5254
styles = Array::reduce.call(styles, ((string, node) -> string+node.outerHTML),'')

test/index.coffee

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ test 'allows custom html and css', (st) ->
8989
templateHtml = fs.readFileSync(template, 'utf8')
9090

9191
image = path.join('file://', __dirname, '../example/image.png')
92-
console.log(image)
9392
templateHtml = templateHtml.replace('{{image}}', image)
9493

9594
options =

0 commit comments

Comments
 (0)