Unnecessary invocation of sitewide_alert/load route when no active alert exists increases server load

Created on 13 October 2024, 2 months ago

Problem/Motivation

The init.js script is invoking the sitewide_alert/load route on every request, even when there is no active sitewide alert. This unnecessary invocation increases server load and can impact server costs due to the repeated route calls, even when no alert needs to be displayed.

Steps to reproduce

  1. Ensure there are no active sitewide alerts configured.
  2. Load any page on the site where the sitewide_alert feature is enabled.
  3. Inspect the network activity in the browser's developer tools.
  4. Observe the route sitewide_alert/load is called, even when no alerts exist.

Proposed resolution

Modify the code logic to conditionally invoke the sitewide_alert/load route only when an active sitewide alert entity is present. This can be done by checking whether there are any active sitewide alerts before initiating the init.js call to the sitewide_alert/load route.

I am working on to add a patch for that.

Feature request
Status

Active

Version

2.2

Component

Code

Created by

🇮🇳India mdeahmad Mumbai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024