graphql-kafkajs-subscriptions
graphql-kafkajs-subscriptions copied to clipboard
Fix memory leak and improve performance
- unsubscribe didn't remove the index from the map
- subscribe needed to create an array of all keys to get the next index
- the map used arrays to store all indexes, replaced with a Set for faster lookup
- Added tests before the fix to verify it still works fine
- Tested performance of adding 100K subscribers and publishing a message: new implementation: 85ms old implementation: 120 sec
must have closed it by mistake