cefn / lauf

Monorepo for lauf packages.
MIT License
5 stars 0 forks source link

Consider blocking behaviour when queue full #149

Open cefn opened 3 years ago

cefn commented 3 years ago

Currently in the case where the queue is full, a send is abandoned and simply returns false to indicate nothing was sent.

https://github.com/cefn/lauf/blob/c689f6e78085b79c90222bba4f359037ab0fdb7e/modules/queue/src/queue.ts#L22-L28

A preferred (default) behaviour is probably to block until a receiver can take an item off the queue. Could be send flag or queue config flag, or ability to set the default blocking for a queue. E.g.

This allows a simple case where the queue length is 0 and the send is blocking, where it converges to the behaviour of Go channels... https://tour.golang.org/concurrency/2