Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to await for the browser to be closed to send back the screenshot #653

Merged
merged 1 commit into from
Jun 12, 2018

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
@@ -35,7 +35,7 @@ app.use(async (req, res) => {
const page = await browser.newPage();
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

ahrarmonsur pushed a commit that referenced this pull request Nov 18, 2022
🤖 I have created a release \*beep\* \*boop\* 
---
### [3.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.1.0...v3.1.1) (2020-07-23)


### Bug Fixes

* publish missing client config annotations ([#653](https://www.github.com/googleapis/nodejs-dialogflow/issues/653)) ([b368797](https://www.github.com/googleapis/nodejs-dialogflow/commit/b36879723fd3aeab0c158d3ab76a5aa6505498e1))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
ahrarmonsur pushed a commit that referenced this pull request Nov 18, 2022
🤖 I have created a release \*beep\* \*boop\* 
---
### [3.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.1.0...v3.1.1) (2020-07-23)


### Bug Fixes

* publish missing client config annotations ([#653](https://www.github.com/googleapis/nodejs-dialogflow/issues/653)) ([b368797](https://www.github.com/googleapis/nodejs-dialogflow/commit/b36879723fd3aeab0c158d3ab76a5aa6505498e1))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
NimJay pushed a commit that referenced this pull request Nov 18, 2022
🤖 I have created a release \*beep\* \*boop\* 
---
### [3.1.1](https://www.github.com/googleapis/nodejs-dialogflow/compare/v3.1.0...v3.1.1) (2020-07-23)


### Bug Fixes

* publish missing client config annotations ([#653](https://www.github.com/googleapis/nodejs-dialogflow/issues/653)) ([b368797](https://www.github.com/googleapis/nodejs-dialogflow/commit/b36879723fd3aeab0c158d3ab76a5aa6505498e1))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
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