Skip to content

Add support for context handling #339

Open
@Lenart12

Description

@Lenart12

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions