Skip to content

Commit f8885f0

Browse files
authored
Fix comment on WithBufferSize (#5)
1 parent 0c85de3 commit f8885f0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

dsqueue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ func (q *DSQueue) worker(ctx context.Context, bufferSize, dedupCacheSize int, id
153153
if err := q.ds.Put(ctx, k, nil); err != nil {
154154
log.Errorw("failed to write item to datastore", "err", err, "qname", q.name)
155155
}
156-
counter++
157156
}
158157
if inBuf.Len() != 0 {
159158
err := q.commitInput(ctx, counter, &inBuf)
@@ -219,6 +218,7 @@ func (q *DSQueue) worker(ctx context.Context, bufferSize, dedupCacheSize int, id
219218
// the input buffer.
220219
item = inBuf.PopFront()
221220
k = makeKey(item, counter)
221+
counter++
222222
}
223223
}
224224

option.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ func getOpts(opts []Option) config {
3939

4040
// WithBufferSize sets the limit on number of items kept in input buffer
4141
// memory, at which they are all written to the datastore. A value of 0 means
42-
// items are only written to the datastore at shutdown, and read from the
43-
// datastore at start.
42+
// the buffer size is unlimited, and items are only written to the datastore
43+
// when the queue has been idle more then the idle write time or when the queue
44+
// is closed.
4445
func WithBufferSize(n int) Option {
4546
return func(c *config) {
4647
if n < 0 {

0 commit comments

Comments
 (0)