From 7f555f971a2b64d3378bfc6ee3feac3a0e39804b Mon Sep 17 00:00:00 2001 From: gammazero <11790789+gammazero@users.noreply.github.com> Date: Wed, 10 Sep 2025 20:52:56 -1000 Subject: [PATCH] Fix comment on WithBufferSize --- dsqueue.go | 2 +- option.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dsqueue.go b/dsqueue.go index 175436b..c453092 100644 --- a/dsqueue.go +++ b/dsqueue.go @@ -153,7 +153,6 @@ func (q *DSQueue) worker(ctx context.Context, bufferSize, dedupCacheSize int, id if err := q.ds.Put(ctx, k, nil); err != nil { log.Errorw("failed to write item to datastore", "err", err, "qname", q.name) } - counter++ } if inBuf.Len() != 0 { err := q.commitInput(ctx, counter, &inBuf) @@ -219,6 +218,7 @@ func (q *DSQueue) worker(ctx context.Context, bufferSize, dedupCacheSize int, id // the input buffer. item = inBuf.PopFront() k = makeKey(item, counter) + counter++ } } diff --git a/option.go b/option.go index 896bb39..72518a2 100644 --- a/option.go +++ b/option.go @@ -39,8 +39,9 @@ func getOpts(opts []Option) config { // WithBufferSize sets the limit on number of items kept in input buffer // memory, at which they are all written to the datastore. A value of 0 means -// items are only written to the datastore at shutdown, and read from the -// datastore at start. +// the buffer size is unlimited, and items are only written to the datastore +// when the queue has been idle more then the idle write time or when the queue +// is closed. func WithBufferSize(n int) Option { return func(c *config) { if n < 0 {