prevent setInterval calls from queueing

This commit is contained in:
byte[] 2020-01-13 08:14:16 -05:00
parent 85a903a191
commit 3315c60789
2 changed files with 5 additions and 3 deletions

View file

@ -33,6 +33,8 @@ function getNewNotifications() {
makeRequest('GET').then(response => response.json()).then(({ notifications }) => {
updateNotificationTicker(notifications);
storeNotificationCount(notifications);
setTimeout(getNewNotifications, NOTIFICATION_INTERVAL);
});
}
@ -55,7 +57,7 @@ function setupNotifications() {
if (!window.booru.userIsSignedIn) return;
// Fetch notifications from the server at a regular interval
setInterval(getNewNotifications, NOTIFICATION_INTERVAL);
setTimeout(getNewNotifications, NOTIFICATION_INTERVAL);
// Update the current number of notifications based on the latest page load
storeNotificationCount($('.js-notification-ticker').dataset.notificationCount);

View file

@ -19,7 +19,7 @@ defmodule Mix.Tasks.ReindexAll do
@shortdoc "Destroys and recreates all Elasticsearch indices."
def run(_) do
if Mix.env() == "prod" do
if Mix.env() == :prod do
raise "do not run this task in production"
end