Skip to content

Commit

Permalink
changed event emitter max listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
digas99 committed Sep 25, 2022
1 parent a956c12 commit 3fc7694
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ const IP = process.env.IP || "127.0.0.1";
const PROTOCOL = process.env.IP ? "https" : "http";
const URL = PROTOCOL+"://"+IP+(process.env.PORT ? "" : ":"+PORT);

/**
* Increase the max event listeners on a global scale
* to prevent this error.
*
* MaxListenersExceededWarning:
* Possible EventEmitter memory leak detected.
* Use emitter.setMaxListeners() to increase limit
*/
require('events').EventEmitter.prototype._maxListeners = 25;

app.enable('trust proxy');

// middleware to force https
Expand Down
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# [Changelog v1.0.6](https://github.com/digas99/paco-ua-api/releases/tag/v1.0.6)
Released on 25/09/2022

## Bug Fixes
- Changed EventEmitter max listeners to prevent heroku from crashing server when multiple concurrent requests are made to the API

# [Changelog v1.0.5](https://github.com/digas99/paco-ua-api/releases/tag/v1.0.5)
Released on 25/09/2022

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "paco-ua-api",
"version": "1.0.3",
"version": "1.0.6",
"description": "API for Portal Académico Online - Universidade de Aveiro. This API uses a headless browser to fetch data directly from [paco.ua.pt](https://paco.ua.pt), so its uptime and latency may be impacted by the website itself. This app is a personal project and has no affiliation with Universidade de Aveiro. For more information check the [Github repository](https://github.com/digas99/paco-ua-api).",
"main": "app.js",
"scripts": {
Expand Down

0 comments on commit 3fc7694

Please sign in to comment.