That wasn’t my take on the OPs need. He said the consumer is very expensive - 
implying to me they only want to process the latest. If dropping the oldest is 
viable you might as well drop all old entries and use the latest. 

Pretty common in trading systems with a price feed - in many cases only the 
latest price matters. 

Not a big deal either way - only pointing it out. 

>> On Nov 14, 2020, at 10:18 PM, Kurtis Rader <kra...@skepticism.us> wrote:
> 
>> On Sat, Nov 14, 2020 at 7:54 PM Robert Engels <reng...@ix.netcom.com> wrote:
> 
>> I don’t think a ring buffer works. At least in a traditional ring buffer the 
>> producer cannot pass the consumer - if the buffer is full the producer 
>> blocks or drops. Trying to ensure the consumer always reads the most recent 
>> available item is better (and more simply) served with a shared hand off 
>> queue.
> 
> It is trivial to create a ring buffer type that drops the oldest queued item 
> when appending a new item if the ring is full. Which would seem to be the 
> behavior the O.P. wants. The important question in this scenario is whether 
> such an object must be useful in a `select` statement. If not the 
> implementation is borderline trivial.
> 
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD82zaBDcyuCPGayqLmf0oHA7SYi2uNaZ2WYUOAsrAzVag%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/21BC31A3-D9DC-4E2A-A8A1-7A0B5F078392%40ix.netcom.com.

Reply via email to