Ignore connection error when closing pulsar consumer (#22607)

Signed-off-by: Enwei Jiao <enwei.jiao@zilliz.com>
pull/22628/head
Enwei Jiao 2023-03-08 14:57:51 +08:00 committed by GitHub
parent 955bc06165
commit f1ec78d3c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -124,6 +124,13 @@ func (pc *Consumer) Close() {
zap.Error(err))
return nil
}
// Pulsar will automatically clean up subscriptions without consumers, so we can ignore this type of error.
if strings.Contains(err.Error(), "connection closed") {
log.Warn("connection closed, skip unsubscribe",
zap.String("subscription", pc.Subscription()),
zap.Error(err))
return nil
}
return err
}
// only close if unsubscribe successfully