repeater icon indicating copy to clipboard operation
repeater copied to clipboard

Event loop can die if stop() not called

Open jedwards1211 opened this issue 3 years ago • 1 comments

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')
})()

jedwards1211 avatar Sep 29 '22 22:09 jedwards1211

yep encountered this behaviour after many hours ended up here.

andrewmclagan avatar Jul 01 '24 04:07 andrewmclagan