repeater
repeater copied to clipboard
Event loop can die if stop() not called
Opening a separate issue from #49 for the sake of people googling why their process is just dying on them.
It seems a bit too easy to accidentally cause the event loop to die:
const { Repeater } = require('@repeaterjs/repeater')
const test = new Repeater((push, stop) => {
push(1)
// stop()
})
;(async () => {
for await (const value of test) {
console.log(value)
}
// event loop dies before this point unless you uncomment stop() above
console.log('done')
})()
yep encountered this behaviour after many hours ended up here.