-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memory leaks in cloudwatch-integration (#214)
* Stop memory leaking every stream name seen in cloudwatch-integration The _postingEvents variable saved every single seen streamName as a key and these entries were never getting deleted. Since cloudwatch-integration stores _postingEvents as a top level variable, it gets shared between all instances of WinstonCloudWatch and leaks memory. To fix this, delete entries for streams that are not posting events. This is safe to do because the only place where _postingEvents entries get read checks whether the value is falsy. If a key doesn't exist in an object, accessing it returns `undefined` which is falsy and the code works the same as before. * Stop memory leaking CloudWatch sequence tokens in cloudwatch-integration The _nextToken variable saved every sequence token for every stream seen. Since cloudwatch-integration stores _nextToken as a top level variable, it gets shared between all instances of WinstonCloudWatch and leaks memory. To fix this, add a clearSequenceToken method and call it from kthxbye to delete the entry for the WinstonCloudWatch instance that is done sending logs.
- Loading branch information
Showing
4 changed files
with
49 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters