Skip to content

Commit

Permalink
[1.3] Upgrade puppeteer (#488)
Browse files Browse the repository at this point in the history
* upgrade puppeteer & change report timeout

Signed-off-by: Rupal Mahajan <[email protected]>

* Change timeout

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>
  • Loading branch information
rupal-bq authored Oct 5, 2022
1 parent d028bab commit fe168d3
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 70 deletions.
4 changes: 2 additions & 2 deletions dashboards-reports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"jquery": "^3.5.0",
"jsdom": "13.1.0",
"json-2-csv": "^3.7.6",
"puppeteer-core": "^1.19.0",
"puppeteer-core": "^13.7.0",
"react-addons-test-utils": "^15.6.2",
"react-id-generator": "^3.0.1",
"react-markdown": "^4.3.1",
Expand All @@ -44,7 +44,7 @@
"@types/dompurify": "^2.3.3",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jsdom": "^16.2.3",
"@types/puppeteer-core": "^2.0.0",
"@types/puppeteer-core": "^5.4.0",
"@types/react": "^16.9.36",
"@types/react-addons-test-utils": "^0.14.25",
"@types/react-dom": "^16.9.8",
Expand Down
2 changes: 1 addition & 1 deletion dashboards-reports/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class ReportsDashboardsPlugin
this.initializerContext = context;
const timeoutError = new Error('Server busy');
timeoutError.statusCode = 503;
this.semaphore = withTimeout(new Semaphore(1), 180000, timeoutError);
this.semaphore = withTimeout(new Semaphore(1), 300000, timeoutError);
}

public async setup(core: CoreSetup) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const createVisualReport = async (
'--disable-setuid-sandbox',
'--disable-gpu',
'--no-zygote',
'--single-process',
'--font-render-hinting=none',
'--js-flags="--jitless --no-opt"',
'--disable-features=V8OptimizeJavascript',
Expand All @@ -86,6 +85,7 @@ export const createVisualReport = async (
env: {
TZ: timezone || 'UTC',
},
pipe: true,
});
const page = await browser.newPage();

Expand Down Expand Up @@ -115,7 +115,7 @@ export const createVisualReport = async (
});

page.setDefaultNavigationTimeout(0);
page.setDefaultTimeout(100000); // use 100s timeout instead of default 30s
page.setDefaultTimeout(300000); // use 300s timeout instead of default 30s
// Set extra headers that are needed
if (!_.isEmpty(extraHeaders)) {
await page.setExtraHTTPHeaders(extraHeaders);
Expand Down Expand Up @@ -177,7 +177,7 @@ export const createVisualReport = async (
);

// force wait for any resize to load after the above DOM modification
await page.waitFor(1000);
await new Promise(resolve => setTimeout(resolve, 1000));
// crop content
switch (reportSource) {
case REPORT_TYPE.dashboard:
Expand Down Expand Up @@ -327,6 +327,6 @@ const waitForDynamicContent = async (
}

previousLength = currentLength;
await page.waitFor(interval);
await new Promise(resolve => setTimeout(resolve, interval));
}
};
Loading

0 comments on commit fe168d3

Please sign in to comment.