Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Add semaphore to block on puppeteer chromium execution #284

Merged
merged 8 commits into from
Jan 6, 2021
Merged

Conversation

joshuali925
Copy link
Contributor

@joshuali925 joshuali925 commented Jan 5, 2021

Issue #, if available:

Description of changes:

  • currently number of resources for the semaphore is 1
  • semaphore times out and front end fails after 180 seconds, if timeout UI will display this toast:
    image
  • for on demand it displays this toast depending on report source:
    image

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@penghuo
Copy link
Contributor

penghuo commented Jan 5, 2021

Do we have the UT/IT to cover the change?

@codecov
Copy link

codecov bot commented Jan 5, 2021

Codecov Report

Merging #284 (f8abd07) into dev (45abee7) will increase coverage by 0.19%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #284      +/-   ##
==========================================
+ Coverage   74.94%   75.14%   +0.19%     
==========================================
  Files          32       32              
  Lines        1764     1766       +2     
  Branches      342      345       +3     
==========================================
+ Hits         1322     1327       +5     
+ Misses        437      434       -3     
  Partials        5        5              
Impacted Files Coverage Δ
kibana-reports/public/components/main/main.tsx 59.59% <66.66%> (ø)
.../components/main/report_details/report_details.tsx 76.08% <66.66%> (ø)
...bana-reports/public/components/main/main_utils.tsx 76.53% <100.00%> (+3.61%) ⬆️

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 45abee7...f8abd07. Read the comment docs.


constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
this.semaphore = withTimeout(new Semaphore(1), 30000, new Error('timeout'));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think 30 sec is too less a timeout. may be 180 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed to 180 seconds

@joshuali925 joshuali925 merged commit e116bda into opendistro-for-elasticsearch:dev Jan 6, 2021
} else if (error.body.statusCode === 503) {
handleErrorToast(
'Error generating report.',
`Timed out generating report ID ${reportId}. Try again later.`
Copy link
Contributor

Choose a reason for hiding this comment

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

does 503 always because of timeout?

zhongnansu pushed a commit to zhongnansu/kibana-reports that referenced this pull request Jan 6, 2021
…r-elasticsearch#284)

* Add mutex to lock on creating report using puppeteer

* Use semaphore instead of mutex

* change semaphore limit to 1

* Add 30 seconds timeout

* Change timeout to 180 sec, add error message

* Update error message

* Add unit test for timeout error
zhongnansu pushed a commit to zhongnansu/kibana-reports that referenced this pull request Jan 7, 2021
…r-elasticsearch#284)

* Add mutex to lock on creating report using puppeteer

* Use semaphore instead of mutex

* change semaphore limit to 1

* Add 30 seconds timeout

* Change timeout to 180 sec, add error message

* Update error message

* Add unit test for timeout error
zhongnansu pushed a commit that referenced this pull request Jan 7, 2021
* Add mutex to lock on creating report using puppeteer

* Use semaphore instead of mutex

* change semaphore limit to 1

* Add 30 seconds timeout

* Change timeout to 180 sec, add error message

* Update error message

* Add unit test for timeout error
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants