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.
blocking - send() shouldn't return until the message is queued - ensures that function only returns true
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
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