Skip to content

Support cancellation of NGINX Plus API calls #205

Closed

Description

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.

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

refinedIssues that are ready to be prioritized

Type

No type

Projects

  • Status

    ✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions