Skip to content

Commit 7070f4c

Browse files
committed
Update intervals. add WAIT_AFTER_LAST_REQUEST
1 parent 958b8fc commit 7070f4c

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This project provides a **Dockerized prerender service** based on `prerender` wi
2828
| `PORT` | `3000` | Port the service listens on |
2929
| `CACHE_MAXSIZE` | `1000` | Maximum number of cached entries |
3030
| `CACHE_TTL` | `43200`| Cache lifetime in seconds (12 hour) |
31+
| `WAIT_AFTER_LAST_REQUEST` | `200` | Wait time (ms) after last network request before rendering |
3132

3233
---
3334

@@ -84,6 +85,8 @@ services:
8485
- CACHE_MAXSIZE=1000
8586
# Cache duration in seconds (43200s = 12 hours)
8687
- CACHE_TTL=43200
88+
# Wait time in ms after last network request before rendering
89+
- WAIT_AFTER_LAST_REQUEST=200
8790
8891
```
8992

server.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@ const server = prerender({
2020
'--disable-software-rasterizer',
2121
'--metrics-recording-only',
2222
'--no-first-run',
23-
'--safebrowsing-disable-auto-update'
23+
'--safebrowsing-disable-auto-update',
24+
'--blink-settings=imagesEnabled=false'
2425
],
2526
pageLoadTimeout: 20000,
26-
waitAfterLastRequest: 1500,
27-
pageDoneCheckInterval: 300,
27+
waitAfterLastRequest: parseInt(process.env.WAIT_AFTER_LAST_REQUEST, 10) || 200,
28+
pageDoneCheckInterval: 50,
2829
chromeRefreshRate: 100
2930
});
3031

3132
process.env.CACHE_MAXSIZE = process.env.CACHE_MAXSIZE || 1000;
3233
process.env.CACHE_TTL = process.env.CACHE_TTL || 43200;
34+
process.env.WAIT_AFTER_LAST_REQUEST = process.env.WAIT_AFTER_LAST_REQUEST || 200;
3335

3436
// Block requests that typically hang and prevent page from finishing
3537
const BLOCKED_PATTERNS = [

0 commit comments

Comments
 (0)