Skip to content
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

Add support for context handling #339

Open
Lenart12 opened this issue Feb 11, 2025 · 0 comments
Open

Add support for context handling #339

Lenart12 opened this issue Feb 11, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@Lenart12
Copy link

Currently the api does not allow passing context instead of timeouts. My suggestion is to refactor long running methods to their *WithContext alternative and change the existing methods to call those with background context. While this is a large request, I think it is really needed with many applications.

Example:

func (a *Adapter) Connect(address Address, params ConnectionParams) (d Device, e error) {
    d, e = a.ConnectWithContext(context.Background(), address, params)
    return
}

func (a *Adapter) ConnectWithContext(ctx context.Context, address Address, params ConnectionParams) (Device, error) {
    // actual implementation
}
@deadprogram deadprogram added the enhancement New feature or request label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants