gunli commented on PR #1055:
URL:
https://github.com/apache/pulsar-client-go/pull/1055#issuecomment-1631925283
> If we can get it brefore `internalSend`, we can make a easier way to
reserve resouce.
I think is not a problem, you can check the code of
`connectionPool.GetConnection()`/`conn.waitUntilReady()`/`conn.doHandshake`,
when we get a conn from connpool, the conn is ready, and `MaxMessageSize` is
cached in the connection. And in `newPartitionProducer`, when a producer is
newed, the conn is ready, it is safe to get the conn, so `GetMaxMessageSize()`
is safe too.
> It's a bit difficult to understand `sendRequest.callback()` now
`sendRequest.callback` is just a field to store the callback function, in
sendRequest.done(), we call this callback, something like this
```go
func (sr *sendRequest) done(id *MessageID, err error) {
if (sr.semaphore){
sr.semaphore.Release()
}
sr.memLimit.Release()
runcallback(sr.callback, id, err)
metrics.IncXXX()
log.Debug/Error
...
}
```
In any other logic where the request is done, we just call request.done(),
no need to care about resources/callback/metrics/debug logs, the code will be
more clear.
> And I think we can fix these bugs firstly. Refactoring work can be done in
parallel. What do you think?
I agree with that.
--
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]