This is an automated email from the ASF dual-hosted git repository.

rxl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 7fb79b7  fix #350 panic on receiverQueueSize set to -1 (#361)
7fb79b7 is described below

commit 7fb79b76d2fa7c30f013b2d489ebf5db624de3e6
Author: Eugene R <[email protected]>
AuthorDate: Fri Oct 9 05:00:26 2020 +0300

    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
---
 pulsar/consumer_impl.go | 2 +-
 pulsar/reader_impl.go   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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 @@ func newConsumer(client *client, options ConsumerOptions) 
(Consumer, error) {
        }
 
        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 @@ func newReader(client *client, options ReaderOptions) 
(Reader, error) {
        subscriptionName += "-" + generateRandomName()
 
        receiverQueueSize := options.ReceiverQueueSize
-       if receiverQueueSize == 0 {
+       if receiverQueueSize <= 0 {
                receiverQueueSize = defaultReceiverQueueSize
        }
 

Reply via email to