From 36ee17bfbe61179744e543c0f3e085f8d396c1ba Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Thu, 13 Apr 2023 12:35:57 -0400 Subject: [PATCH] chore(notifier): Annote subscriber rejections that follow disconnection --- packages/notifier/src/subscribe.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/notifier/src/subscribe.js b/packages/notifier/src/subscribe.js index 626fe01c05dc..637fdd932561 100644 --- a/packages/notifier/src/subscribe.js +++ b/packages/notifier/src/subscribe.js @@ -3,6 +3,7 @@ import { isUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js'; import './types-ambient.js'; +const { details: X } = assert; const sink = () => {}; /** @@ -14,6 +15,7 @@ const sink = () => {}; * @returns {Promise} */ const reconnectAsNeeded = async thunk => { + let initialDisconnection; let lastVersion = -Infinity; // End synchronous prelude. await null; @@ -24,6 +26,9 @@ const reconnectAsNeeded = async thunk => { return result; } catch (err) { if (isUpgradeDisconnection(err)) { + if (!initialDisconnection) { + initialDisconnection = err; + } const { incarnationNumber: version } = err; if (version > lastVersion) { // We don't expect another upgrade in between receiving @@ -33,6 +38,12 @@ const reconnectAsNeeded = async thunk => { continue; } } + if (initialDisconnection && initialDisconnection !== err) { + assert.note( + err, + X`Attempting to recover from disconnection: ${initialDisconnection}`, + ); + } throw err; } }