Skip to content

cancel watches #2860

@travisghansen

Description

@travisghansen

With version 1.4.0 watch.watch returns a Promise that is the AbortController. When using a resourceVersion=X param (only retrieve updates from the current state) the Promise appears to only resolve after the first update has been received.

In my case I am trying to do some crude dead peer/watch detection and this pattern has some challenges. Let's say I have a 10m inactivity window where I consider the peer/watch dead if no messages have been received in that window. If nothing comes through in the 10m window I still have an unresolved Promise and therefore cannot call AbortController.abort() to abort the request. If I can't abort the request and just recreate a new watch I possibly end up with multiple active watches.

Any thoughts or other ideas about how to sanely check for dead peer/watches and/or how to deal with the AbortController not being available until the first message has been received?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions