Skip to content

Commit

Permalink
JetStream: auto-ack callback would do sync acks
Browse files Browse the repository at this point in the history
This is due to a change in PR #516 that is making any Ack call
that passes an option to transform the call to sync calls if
option has a Wait value set.
The auto-ack callback was calling ack with the jetstream's context
options, which has always a Wait by default of 5sec.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
  • Loading branch information
kozlovic committed Mar 1, 2022
1 parent 51a4ffc commit 3040193
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js.c
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ _autoAckCB(natsConnection *nc, natsSubscription *sub, natsMsg *msg, void *closur
// Invoke user callback
(jsi->usrCb)(nc, sub, msg, jsi->usrCbClosure);

natsMsg_Ack(msg, &(jsi->js->opts));
natsMsg_Ack(msg, NULL);
natsMsg_clearNoDestroy(msg);
natsMsg_Destroy(msg);
}
Expand Down
5 changes: 5 additions & 0 deletions test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -24009,6 +24009,11 @@ test_JetStreamSubscribe(void)
for (i=0; (s == NATS_OK) && (i < 3); i++)
{
s = natsSubscription_NextMsg(&ack, ackSub, 1000);
if (s == NATS_OK)
{
// Make sure this was not a sync call...
s = (natsMsg_GetReply(ack) == NULL ? NATS_OK : NATS_ERR);
}
natsMsg_Destroy(ack);
ack = NULL;
}
Expand Down

0 comments on commit 3040193

Please sign in to comment.