mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
prevent setInterval calls from queueing
This commit is contained in:
parent
85a903a191
commit
3315c60789
2 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||
|
@ -66,4 +68,4 @@ function setupNotifications() {
|
|||
bindSubscriptionLinks();
|
||||
}
|
||||
|
||||
export { setupNotifications };
|
||||
export { setupNotifications };
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue