Skip to content

Commit 4818164

Browse files
committed
Don't log Redis worker DLQ errors if we're ignoring
1 parent 0dc05d0 commit 4818164

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

packages/redis-worker/src/worker.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,17 @@ class Worker<TCatalog extends WorkerCatalog> {
621621
const retryDelay = calculateNextRetryDelay(retrySettings, newAttempt);
622622

623623
if (!retryDelay) {
624-
this.logger.error(`Worker item reached max attempts. Moving to DLQ.`, {
625-
name: this.options.name,
626-
id,
627-
job,
628-
item,
629-
visibilityTimeoutMs,
630-
attempt: newAttempt,
631-
errorMessage,
632-
});
624+
if (shouldLogError) {
625+
this.logger.error(`Worker item reached max attempts. Moving to DLQ.`, {
626+
...logAttributes,
627+
attempt: newAttempt,
628+
});
629+
} else {
630+
this.logger.info(`Worker item reached max attempts. Moving to DLQ.`, {
631+
...logAttributes,
632+
attempt: newAttempt,
633+
});
634+
}
633635

634636
await this.queue.moveToDeadLetterQueue(id, errorMessage);
635637

0 commit comments

Comments
 (0)