Skip to content

Commit

Permalink
feat: make BROWSER_TRY_RESTART_PERIOD configurable in the server options
Browse files Browse the repository at this point in the history
  • Loading branch information
Laszlo Luczo committed May 6, 2024
1 parent f243ac9 commit 19fcb43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 5.21.0 - 2024-05-06
### Changed
- Make `BROWSER_TRY_RESTART_PERIOD` configurable in the server options

## 5.20.4 - 2024-04-18
### Changed
- Fix `extraChromeFlags` option: `TypeError: Assignment to constant variable.`
Expand Down
3 changes: 2 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ server.init = function(options) {
this.options.browserDebuggingPort = this.options.browserDebuggingPort || BROWSER_DEBUGGING_PORT;
this.options.timeoutStatusCode = this.options.timeoutStatusCode || TIMEOUT_STATUS_CODE;
this.options.parseShadowDom = this.options.parseShadowDom || PARSE_SHADOW_DOM;
this.options.browserTryRestartPeriod = this.options.browserTryRestartPeriod || BROWSER_TRY_RESTART_PERIOD;

this.browser = require('./browsers/chrome');

Expand Down Expand Up @@ -324,7 +325,7 @@ server.finish = function(req, res) {
req.prerender.responseSent = true;
this.removeRequestFromInFlight(req);

if (!this.isAnyRequestInFlight() && new Date().getTime() - this.lastRestart > BROWSER_TRY_RESTART_PERIOD) {
if (!this.isAnyRequestInFlight() && new Date().getTime() - this.lastRestart > this.options.browserTryRestartPeriod) {
this.lastRestart = new Date().getTime();
this.restartBrowser();
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Prerender.io",
"name": "prerender",
"description": "Service to prerender Javascript rendered pages for SEO",
"version": "5.20.4",
"version": "5.21.0",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -28,4 +28,4 @@
"engines": {
"node": ">=10"
}
}
}

0 comments on commit 19fcb43

Please sign in to comment.