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!
With version
1.4.0watch.watchreturns aPromisethat is theAbortController. When using aresourceVersion=Xparam (only retrieve updates from the current state) thePromiseappears 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
Promiseand therefore cannot callAbortController.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
AbortControllernot being available until the first message has been received?Thanks!