From 83aa1778d710fb874229bd7e22402d88e20b39d7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 14:18:02 +0000 Subject: [PATCH] Refactor force-index script to execute API requests concurrently using Promise.all Co-authored-by: lsb11 <269203137+lsb11@users.noreply.github.com> --- scripts/force-index.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/force-index.cjs b/scripts/force-index.cjs index 6dce634..c26dee2 100644 --- a/scripts/force-index.cjs +++ b/scripts/force-index.cjs @@ -38,7 +38,7 @@ async function getJwtClient() { async function forceIndexUrls(jwtClient, urls) { const indexing = google.indexing({ version: 'v3', auth: jwtClient }); - for (const url of urls) { + await Promise.all(urls.map(async (url) => { try { const res = await indexing.urlNotifications.publish({ requestBody: { @@ -50,7 +50,7 @@ async function forceIndexUrls(jwtClient, urls) { } catch (err) { console.error(`Failed to request indexing for ${url}:`, err.message); } - } + })); } async function main() {