Skip to content

Conversation

@glaforge
Copy link
Contributor

Awaiting for the headless browser to be closed add a certain amount of time to the duration of the request, although the image is already ready to be sent back to the user.

/cc @steren

…shot

Awaiting for the headless browser to be closed add a certain amount of time to the duration of the request, although the image is already ready to be sent back to the user.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 12, 2018
@steren
Copy link
Contributor

steren commented Jun 12, 2018

Thanks!

1 similar comment
@steren
Copy link
Contributor

steren commented Jun 12, 2018

Thanks!

@codecov
Copy link

codecov bot commented Jun 12, 2018

Codecov Report

Merging #653 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #653   +/-   ##
=======================================
  Coverage   48.52%   48.52%           
=======================================
  Files           1        1           
  Lines          68       68           
=======================================
  Hits           33       33           
  Misses         35       35

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41a569b...3a603c4. Read the comment docs.

@fhinkel fhinkel merged commit 20e87ca into GoogleCloudPlatform:master Jun 12, 2018
await page.goto(url);
const imageBuffer = await page.screenshot();
await browser.close();
browser.close();
Copy link
Contributor

@MylesBorins MylesBorins Jun 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it have made more sense to put the res.set & res.send calls before await browser.close? Keeping the await ensured that the browser session was closed without error before the route was finished.

Albeit there is no error handling in this example, so any throw would cause an unhandled exception error, but it does seem odd to me to have this async operation continue doing it's thing after the function has returned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants