Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix panic when creating consumer with ReceiverQueueSize set to -1 #289

Merged
merged 3 commits into from
Jun 19, 2020
Merged

fix panic when creating consumer with ReceiverQueueSize set to -1 #289

merged 3 commits into from
Jun 19, 2020

Conversation

shohi
Copy link
Contributor

@shohi shohi commented Jun 19, 2020

Fixes #288

@wolfstudy
Copy link
Member

// Set to -1 to disable prefetching in consumer
ReceiverQueueSize int

@shohi Can you remove the comments from ReceiverQueueSize?

@wolfstudy wolfstudy added this to the 0.2.0 milestone Jun 19, 2020
@shohi
Copy link
Contributor Author

shohi commented Jun 19, 2020

// Set to -1 to disable prefetching in consumer
ReceiverQueueSize int

@shohi Can you remove the comments from ReceiverQueueSize?

Or change the description?

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM, just little comments. please check

// disable receiver queue if queue size is negative
if options.ReceiverQueueSize < 0 {
options.ReceiverQueueSize = 0
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can fix it using follows way:

	if options.ReceiverQueueSize <= 0 {
		options.ReceiverQueueSize = 1000
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unbuffered chan may be useful for some cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure whether it's a good idea to remove this option. If negative value is totally disallowed (should be reflected in comments), i think it's ok to panic though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to the flow mechanism of messages in pulsar. By default, the value of the receiveQueueSize is 1000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll update the modification and comments according to your suggestions.

@wolfstudy
Copy link
Member

// Set to -1 to disable prefetching in consumer
ReceiverQueueSize int

@shohi Can you remove the comments from ReceiverQueueSize?

Or change the description?

Yes.

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks @shohi

@wolfstudy wolfstudy merged commit 826df81 into apache:master Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failed to create consumer with ReceiverQueueSize set to -1
2 participants