From 3e8ebf84cff5c8a68b159ef11072693d1ba4625b Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 15 Apr 2024 14:03:52 -0500 Subject: [PATCH] Website: Reduce number of requests to the Algolia crawler (#18277) Related to: #18242 Changes: - Updated the request that is sent to the Algolia crawler to only be sent from the `web.1` dyno in Heroku. --- website/api/hooks/custom/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/api/hooks/custom/index.js b/website/api/hooks/custom/index.js index 20a7884014..8b579bd690 100644 --- a/website/api/hooks/custom/index.js +++ b/website/api/hooks/custom/index.js @@ -88,8 +88,8 @@ will be disabled and/or hidden in the UI. from: sails.config.custom.fromEmailAddress, fromName: sails.config.custom.fromName, }); - - if(sails.config.environment === 'production'){ + // Send a request to our Algolia crawler to reindex the website. + if(sails.config.environment === 'production' && process.env.DYNO === 'web.1'){ sails.helpers.http.post.with({ url: `https://crawler.algolia.com/api/1/crawlers/${sails.config.custom.algoliaCrawlerId}/reindex`, headers: { 'Authorization': sails.config.custom.algoliaCrawlerApiToken}