fix #350 panic on receiverQueueSize set to -1 (#361)
Fixes #350
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change is a trivial rework / code cleanup without any test coverage.
### Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API: no
- The schema: no
- The default values of configurations: no
- The wire protocol: no
### Documentation
- Does this pull request introduce a new feature? no
diff --git a/pulsar/consumer_impl.go b/pulsar/consumer_impl.go
index 97afbaa..13339af 100644
--- a/pulsar/consumer_impl.go
+++ b/pulsar/consumer_impl.go
@@ -93,7 +93,7 @@
}
if options.ReceiverQueueSize <= 0 {
- options.ReceiverQueueSize = 1000
+ options.ReceiverQueueSize = defaultReceiverQueueSize
}
if options.Interceptors == nil {
diff --git a/pulsar/reader_impl.go b/pulsar/reader_impl.go
index 8083b06..17a7084 100644
--- a/pulsar/reader_impl.go
+++ b/pulsar/reader_impl.go
@@ -85,7 +85,7 @@
subscriptionName += "-" + generateRandomName()
receiverQueueSize := options.ReceiverQueueSize
- if receiverQueueSize == 0 {
+ if receiverQueueSize <= 0 {
receiverQueueSize = defaultReceiverQueueSize
}