File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,17 @@ export default async function sendMessage(body: Body): Promise<void> {
2929 const webhookUrls = env . DISCORD_WEBHOOK_URL . split ( ',' ) ;
3030 let successCount = 0 ;
3131
32- for ( const url of webhookUrls ) {
33- const success = await sendWebhook ( body , url ) ;
34- if ( success ) {
35- successCount ++ ;
36- } else {
37- console . error ( `Failed to send webhook: ${ url } ` ) ;
38- }
39- }
32+ const results = await Promise . all (
33+ webhookUrls . map ( async ( url ) => {
34+ const success = await sendWebhook ( body , url ) ;
35+ if ( ! success ) {
36+ console . error ( `Failed to send webhook: ${ url } ` ) ;
37+ }
38+ return success ;
39+ } ) ,
40+ ) ;
41+
42+ successCount = results . filter ( Boolean ) . length ;
4043
4144 if ( env . ENABLE_LOGGER ) {
4245 // Log the number of successful webhooks
You can’t perform that action at this time.
0 commit comments