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 Apr 28, 2023
1 parent faa0e2b commit 9e3089e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 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
20 changes: 14 additions & 6 deletions packages/notifier/test/test-publish-kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,16 @@ 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);
void E.when(
sub1.subscribeAfter(),
cell => void sub1FirstAll.push(cell),
t.fail,
);
void E.when(
sub1.subscribeAfter(),
cell => void sub1FirstAll.push(cell),
t.fail,
);

pub2.publish(undefined);
sub2LIFO.unshift(await sub2.subscribeAfter());
Expand All @@ -670,17 +678,17 @@ 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(
void E.when(
sub1.subscribeAfter(0n),
cell => void sub1FirstLateAll.push(cell),
t.fail,
);
E.when(
void E.when(
sub1.subscribeAfter(sub1FirstAll[0].publishCount),
cell => void sub1SecondAll.push(cell),
t.fail,
Expand Down Expand Up @@ -711,7 +719,7 @@ const verifySubscribeAfterSequencing = test.macro(async (t, makePublishKit) => {
for (const p of [sub1.subscribeAfter(), sub1.subscribeAfter(0n)]) {
E.when(p, cell => void sub1SecondLateAll.push(cell), t.fail);
}
E.when(
void E.when(
sub1.subscribeAfter(sub1SecondAll[0].publishCount),
result => void sub1FinalAll.push(result),
t.fail,
Expand Down

0 comments on commit 9e3089e

Please sign in to comment.