cstephen/hashtag-count

intervalCb results grow forever

Opened this issue · 0 comments

I noticed you are always appending new keys to the same {} for results. This can grow to an unruly size and pretty quickly if left alone for awhile.

May I suggest you only return the results for the single interval? Leave it up to us users to reconcile if we need to.

If anyone else is wanting a quick solve here is what I did

const intervalCb = (err, results) => {
		if (err) {
			console.log(err);
		} else {
			console.log(results);
			// delete the key in the object. It's passed by reference so we can clean it up here.
			const key = Object.keys(results)[0];
			delete results[key];
		}
	},