From 68f03688e30e9bf9ea5ec2ff5f20dfeec3758759 Mon Sep 17 00:00:00 2001 From: Erik Nilsen Date: Fri, 10 Apr 2026 09:56:35 -0700 Subject: [PATCH] docs: add WARNING line for silent duplicate skipping in BatchEnqueue --- internal/rdb/rdb.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/rdb/rdb.go b/internal/rdb/rdb.go index 5281086..23f0e69 100644 --- a/internal/rdb/rdb.go +++ b/internal/rdb/rdb.go @@ -143,15 +143,14 @@ func (r *RDB) Enqueue(ctx context.Context, msg *base.TaskMessage) error { // Each item is either enqueued immediately (ProcessAt is zero) or added to the // scheduled sorted set. // +// WARNING: tasks whose IDs already exist in Redis are silently skipped. +// // The pipeline executes independent Lua scripts per task — there is no // MULTI/EXEC wrapping the batch, so individual tasks may succeed or fail -// independently. A task whose ID already exists in Redis is skipped by the Lua -// script (returns 0) and does not count toward the returned enqueued total. -// -// The returned int is the number of tasks that were actually written to Redis -// (i.e. whose IDs did not already exist). The returned error is non-nil only -// when the pipeline call itself fails (network error, context cancellation, -// etc.), in which case no individual result should be trusted. +// independently. The returned int is the number of tasks actually written; +// skipped duplicates do not count. The returned error is non-nil only when the +// pipeline call itself fails (network error, context cancellation, etc.), in +// which case no individual result should be trusted. // // Message encoding errors cause an immediate return before any Redis I/O. func (r *RDB) BatchEnqueue(ctx context.Context, items []base.BatchEnqueueItem) (int, error) {