-
Notifications
You must be signed in to change notification settings - Fork 199
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
Missing context.Context in all API methods #255
Comments
This statement is clearly wrong, since the timeout on the policy (in this case a
You are also proliferating your goroutines at an alarming rate with your implementation, which may add significant latency under high load. |
This is indeed something I missed (actually was looking for it). Good to know.
Understood. But since it's becoming a standard in many Golang libs I would consider it for a future version.
Indeed, that is the biggest cons. So I am left with the tradeoff of either supporting context as well behaved libraries should and by that risk goroutine proliferation, or just use the BasePolicy Timeout (thanks for the tip) and not support a context. |
We would really like this feature for Dapr too |
The Aerospike Go Client is a high performance library that supports hundreds of thousands of transactions per second per instance. Context support would require us to spawn a new goroutine for every request, adding significant overhead to the scheduler and GC. |
In golang it is considered best practice that outgoing requests would accept a
context.Context
https://golang.org/pkg/context/The motivation being that in many cases it is desirable to either cancel a request or timeout (deadline) a request.
Although there is a timeout property on aerospike's client itself, this timeout is global to all operations while in reality you sometimes want a different timeout for different calls.
Ideally I would modify, for example:
to:
This change would apply to all client API methods.
What are the pros or cons of making this change? Other than the obvious fact that this is an API change that requires code changes from library users?
Right now I'm left with the option of wrapping the client myself with such context, which is a burden I would prefer the core lib to maintain.
Example:
This topic had been discussed before in a narrow context (no pun intended) but I want to reopen the discussion in a wider scope #218
Thank you
The text was updated successfully, but these errors were encountered: