Skip to content

Commit

Permalink
style(notifier): Sink all promises
Browse files Browse the repository at this point in the history
Refs #6000
  • Loading branch information
kriskowal committed May 1, 2023
1 parent f904b95 commit d224044
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions packages/notifier/src/stored-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export const makeStoredNotifier = (notifier, storageNode, marshaller) => {
fail(reason) {
console.error('StoredNotifier failed to iterate', reason);
},
}).catch(reason => {
console.error('StoredNotifier halted iteration', reason);
});

/** @type {Unserializer} */
Expand Down
30 changes: 15 additions & 15 deletions packages/notifier/test/test-publish-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,12 @@ const verifySubscribeAfterSequencing = test.macro(async (t, makePublishKit) => {
const sub2LIFO = [];

const sub1FirstAll = [];
E.when(sub1.subscribeAfter(), cell => void sub1FirstAll.push(cell), t.fail);
E.when(sub1.subscribeAfter(), cell => void sub1FirstAll.push(cell), t.fail);
E.when(sub1.subscribeAfter(), cell => void sub1FirstAll.push(cell)).catch(
t.fail,
);
E.when(sub1.subscribeAfter(), cell => void sub1FirstAll.push(cell)).catch(
t.fail,
);

pub2.publish(undefined);
sub2LIFO.unshift(await sub2.subscribeAfter());
Expand All @@ -670,21 +674,18 @@ const verifySubscribeAfterSequencing = test.macro(async (t, makePublishKit) => {

const sub1FirstLateAll = [];
const sub1SecondAll = [];
E.when(
void E.when(
sub1.subscribeAfter(),
cell => void sub1FirstLateAll.push(cell),
t.fail,
);
E.when(
).catch(t.fail);
void E.when(
sub1.subscribeAfter(0n),
cell => void sub1FirstLateAll.push(cell),
t.fail,
);
E.when(
).catch(t.fail);
void E.when(
sub1.subscribeAfter(sub1FirstAll[0].publishCount),
cell => void sub1SecondAll.push(cell),
t.fail,
);
).catch(t.fail);

pub2.publish(undefined);
sub2LIFO.unshift(await sub2.subscribeAfter(sub2LIFO[0].publishCount));
Expand All @@ -709,13 +710,12 @@ const verifySubscribeAfterSequencing = test.macro(async (t, makePublishKit) => {
const sub1SecondLateAll = [];
const sub1FinalAll = [];
for (const p of [sub1.subscribeAfter(), sub1.subscribeAfter(0n)]) {
E.when(p, cell => void sub1SecondLateAll.push(cell), t.fail);
E.when(p, cell => void sub1SecondLateAll.push(cell)).catch(t.fail);
}
E.when(
void E.when(
sub1.subscribeAfter(sub1SecondAll[0].publishCount),
result => void sub1FinalAll.push(result),
t.fail,
);
).catch(t.fail);

pub2.publish(undefined);
sub2LIFO.unshift(await sub2.subscribeAfter(sub2LIFO[0].publishCount));
Expand Down

0 comments on commit d224044

Please sign in to comment.