Gleiphir2769 commented on PR #835: URL: https://github.com/apache/pulsar-client-go/pull/835#issuecomment-1236293799
> Can we let dipatcher() to manage the availablePermits since most cases already covered by various signals in dispatcher()'s select cases. The benefits are 1) centralize one function to manage availablePermits 2) to avoid using Atomic or any synchronizing because avialablePermits can only updated one at a time. To achieve that, can we have failure cases from MessageReceived() to send a signal to a new channel that dispatcher() listens to that will call your new function increasePermitsAndRequestMoreIfNeed() Hi @zzzming. I agree with you that handle the availablePermits in dispatcher(). > > There might be other cases leaking availablePermits. So in the future, those cases can send a sig to this new increasePermits channel. > You are right. Chunking also need to increase availablePermits when all the chunks haven't all arrived yet. So this is also a case where need to request more `availablePermits` after return early from `MessageReceived()`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
