Skip to content

Commit 775a078

Browse files
committed
When nacking, return whether it was put back in the queue or not
1 parent f06e0c2 commit 775a078

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/webapp/app/v3/marqs/index.server.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ export class MarQS {
638638
}
639639

640640
/**
641-
* Negative acknowledge a message, which will requeue the message
641+
* Negative acknowledge a message, which will requeue the message.
642+
* Returns whether it went back into the queue or not.
642643
*/
643644
public async nackMessage(
644645
messageId: string,
@@ -657,7 +658,7 @@ export class MarQS {
657658
updates,
658659
service: this.name,
659660
});
660-
return;
661+
return false;
661662
}
662663

663664
const nackCount = await this.#getNackCount(messageId);
@@ -676,7 +677,7 @@ export class MarQS {
676677

677678
// If we have reached the maximum nack count, we will ack the message
678679
await this.acknowledgeMessage(messageId, "maximum nack count reached");
679-
return;
680+
return false;
680681
}
681682

682683
span.setAttributes({
@@ -705,6 +706,8 @@ export class MarQS {
705706
});
706707

707708
await this.options.subscriber?.messageNacked(message);
709+
710+
return true;
708711
},
709712
{
710713
kind: SpanKind.CONSUMER,

0 commit comments

Comments
 (0)