Skip to content

Commit

Permalink
Increase 'unsolicited' event listener limit
Browse files Browse the repository at this point in the history
This change increases the max listener limit for the `unsolicited` event
in the `LutronCasetaLeap` class to 75 (the per-bridge device limit)
times the number of configured bridges. Previously, the default limit of
10 was being used, which means only 10 devices could be used.

Fixes #15
  • Loading branch information
thenewwazoo committed Jan 27, 2022
1 parent 958be19 commit 68d3249
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Lutron Caseta LEAP",
"name": "homebridge-lutron-caseta-leap",
"version": "2.2.0",
"version": "2.2.1",
"description": "Support for the Lutron Caseta Smart Bridge 2 (non-pro)",
"license": "Apache-2.0",
"repository": {
Expand Down
7 changes: 7 additions & 0 deletions src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ export class LutronCasetaLeap

log.info('LutronCasetaLeap starting up...');

process.on('warning', (e) => this.log.warn(`Got ${e.name} process warning: ${e.message}:\n${e.stack}`));

this.secrets = this.secretsFromConfig(config);
if (this.secrets.size === 0) {
log.warn('No bridge auth configured. Retiring.');
return;
}

// Each device will subscribe to 'unsolicited', which means we very
// quickly hit the limit for EventEmitters. Set this limit to the
// number of bridges times the per-bridge device limit.
this.setMaxListeners(75 * this.secrets.size);

/*
* When this event is fired, homebridge restored all cached accessories from disk and did call their respective
* `configureAccessory` method for all of them. Dynamic Platform plugins should only register new accessories
Expand Down

0 comments on commit 68d3249

Please sign in to comment.