Detect consumer being deleted in JetStreamConsumer

This commit is contained in:
Neil Alexander 2022-11-16 10:28:22 +00:00
parent 1e714bc3b6
commit a916b041b1
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -2,6 +2,7 @@ package jetstream
import (
"context"
"errors"
"fmt"
"github.com/getsentry/sentry-go"
@ -72,6 +73,9 @@ func JetStreamConsumer(
// just timed out and we should try again.
continue
}
} else if errors.Is(err, nats.ErrConsumerDeleted) {
// The consumer was deleted so stop.
return
} else {
// Something else went wrong, so we'll panic.
sentry.CaptureException(err)