kubernetes-client / kubernetes-client/javascript

cancel watches

Open
#2,860 3 comments 1 reaction 2 assignees Claimed by @brendandburns View on GitHub
Dominant language
TypeScript
Stars
2.3k
Forks
568
Avg merge
17h 57m
Merged PRs (30d)
41

Description

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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.