Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use allSettled instead of all such that fireLifecycleEvent doesn't throw #683

Open
wants to merge 1 commit into
base: workspace/v17.0.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,18 @@ export async function fireLifecycleEvent<T = unknown>(
// the loop gets out of sync and items can be missed
const subscribers = [...eventHandlers.subscribers];

await Promise.all(
const subscriberResults = await Promise.allSettled(
subscribers.map(async (idHandler) => {
logger.info(`Notifying subscriber ${idHandler.id} of event ${lifecycleEvent}`);
await idHandler.handler(platform, payload);
return idHandler.id;
})
);
for (const result of subscriberResults) {
if (result.status === "rejected") {
logger.error(`Error notifying subscriber of lifecycle event ${lifecycleEvent}`, result.reason);
}
}
}
}

Expand Down
Loading