@@ -112,7 +112,7 @@ async function fetchOpenCollectiveData() {
112112 * Fetches supporters data from Github API, filters active backers,
113113 * and maps it to the Supporters type.
114114 *
115- * @returns {Promise<Array<import('#site/types/supporters').GithubSponsorSupporter >> } Array of supporters
115+ * @returns {Promise<Array<import('#site/types/supporters').GitHubSponsorSupporter >> } Array of supporters
116116 */
117117async function fetchGithubSponsorsData ( ) {
118118 if ( ! GITHUB_READ_API_KEY ) {
@@ -215,18 +215,27 @@ const graphql = async (query, variables = {}) => {
215215 * Fetches supporters data from Open Collective API and GitHub Sponsors, filters active backers,
216216 * and maps it to the Supporters type.
217217 *
218- * @returns {Promise<Array<import('#site/types/supporters').OpenCollectiveSupporter | import('#site/types/supporters').GithubSponsorSupporter >> } Array of supporters
218+ * @returns {Promise<Array<import('#site/types/supporters').OpenCollectiveSupporter | import('#site/types/supporters').GitHubSponsorSupporter >> } Array of supporters
219219 */
220220async function sponsorsData ( ) {
221221 const seconds = 300 ; // Change every 5 minutes
222222 const seed = Math . floor ( Date . now ( ) / ( seconds * 1000 ) ) ;
223223
224- const sponsors = await Promise . all ( [
224+ const sponsorsResults = await Promise . allSettled ( [
225225 fetchGithubSponsorsData ( ) ,
226226 fetchOpenCollectiveData ( ) ,
227227 ] ) ;
228228
229- const shuffled = await shuffle ( sponsors . flat ( ) , seed ) ;
229+ const sponsors = sponsorsResults . flatMap ( result => {
230+ if ( result . status === 'fulfilled' ) {
231+ return result . value ;
232+ }
233+
234+ console . error ( 'Supporters data source failed:' , result . reason ) ;
235+ return [ ] ;
236+ } ) ;
237+
238+ const shuffled = await shuffle ( sponsors , seed ) ;
230239
231240 return shuffled ;
232241}
0 commit comments