promesa icon indicating copy to clipboard operation
promesa copied to clipboard

Using `offer!` with a buffered channel returns `false`

Open julienvincent opened this issue 2 years ago • 0 comments

I am trying to build a queuing system that puts values onto a buffered chan using offer! under the expectation that offer! should return true if there is still space in the channels buffer.

It seems that the current implementation only returns true if there is a pending take[!].

This behaviour seems rather unexpected to me and perhaps even a bug. It also differs from the bahaviour of core.async offer! which will return true if the value can be put into the channels buffer.

Is this intensional? If not is it possible to rework offer! to return true if the value can be placed into the buffered chan regardless of a pending take[!]?

julienvincent avatar Nov 23 '23 13:11 julienvincent