Description
openedon Jan 18, 2024
Is your feature request related to a problem? Please describe.
As a developer, I'd like to be able to cancel any call I make to NGINX Plus API.
This is required for my software for:
- graceful termination. When that happens, I'd like to be able to quickly terminate any in-progress API calls.
- configuring a API call timeout. I'd like to control how long I can allow a call to NGINX Plus API to last.
Describe the solution you'd like
Using Context https://pkg.go.dev/context#Context is common for that.
func (client *NginxClient) AddHTTPServer(upstream string, server UpstreamServer) error {
func (client *NginxClient) AddHTTPServer(ctx context.Context, upstream string, server UpstreamServer) error {
Describe alternatives you've considered
There is hard-corded timeout that internally creates a context that ensures that a request to NGINX Plus API can't take longer than 10s.
nginx-plus-go-client/client/nginx.go
Line 855 in 970573b
However, I'd like to control cancelation via a context (which can be cancelled before timeout expires). Additionally, I want to control the value of the timeout.
Additional context
Metadata
Assignees
Type
Projects
Status
✅ Done