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.
This commit is contained in:
Eric 2024-04-15 14:03:52 -05:00 committed by GitHub
parent 7785aa5070
commit 3e8ebf84cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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}