Skip to content

Commit b118a27

Browse files
authored
[2.x] Upgrade puppeteer (#489)
* 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]>
1 parent df2e78f commit b118a27

File tree

4 files changed

+156
-71
lines changed

4 files changed

+156
-71
lines changed

dashboards-reports/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"jquery": "^3.5.0",
2727
"jsdom": "13.1.0",
2828
"json-2-csv": "^3.7.6",
29-
"puppeteer-core": "^1.19.0",
29+
"puppeteer-core": "^13.7.0",
3030
"react-addons-test-utils": "^15.6.2",
3131
"react-id-generator": "^3.0.1",
3232
"react-markdown": "^4.3.1",
@@ -44,7 +44,7 @@
4444
"@types/dompurify": "^2.3.3",
4545
"@types/enzyme-adapter-react-16": "^1.0.6",
4646
"@types/jsdom": "^16.2.3",
47-
"@types/puppeteer-core": "^2.0.0",
47+
"@types/puppeteer-core": "^5.4.0",
4848
"@types/react": "^16.14.23",
4949
"@types/react-addons-test-utils": "^0.14.25",
5050
"@types/react-dom": "^16.9.8",

dashboards-reports/server/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class ReportsDashboardsPlugin
4848
this.initializerContext = context;
4949
const timeoutError = new Error('Server busy');
5050
timeoutError.statusCode = 503;
51-
this.semaphore = withTimeout(new Semaphore(1), 180000, timeoutError);
51+
this.semaphore = withTimeout(new Semaphore(1), 300000, timeoutError);
5252
}
5353

5454
public async setup(core: CoreSetup) {

dashboards-reports/server/routes/utils/visual_report/visualReportHelper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export const createVisualReport = async (
7676
'--disable-setuid-sandbox',
7777
'--disable-gpu',
7878
'--no-zygote',
79-
'--single-process',
8079
'--font-render-hinting=none',
8180
'--js-flags="--jitless --no-opt"',
8281
'--disable-features=V8OptimizeJavascript',
@@ -86,6 +85,7 @@ export const createVisualReport = async (
8685
env: {
8786
TZ: timezone || 'UTC',
8887
},
88+
pipe: true,
8989
});
9090
const page = await browser.newPage();
9191

@@ -115,7 +115,7 @@ export const createVisualReport = async (
115115
});
116116

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

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

329329
previousLength = currentLength;
330-
await page.waitFor(interval);
330+
await new Promise(resolve => setTimeout(resolve, interval));
331331
}
332332
};

0 commit comments

Comments
 (0)