kubernetes-client / kubernetes-client/javascript
cancel watches
- 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
Assessment
This issue has not been assessed yet.