[READ-ONLY] Mirror of https://github.com/probablykasper/yt-email-notifier. macOS menubar app for YouTube upload notification emails
email menubar notifications tray youtube
0

Configure Feed

Select the types of activity you want to include in your feed.

Fixed some settings requiring restart

Kasper (Nov 28, 2020, 2:49 AM +0100) e72a2fa7 0b063b99

+25 -18
+25 -18
src/server.js
··· 79 79 80 80 const pLimit = require('p-limit') 81 81 const limit = pLimit(5) 82 - async function refresh(instance) { 82 + module.exports.restartIntervals = async function() { 83 + logger.info('Restarting intervals') 84 + limit.clearQueue() 85 + for (let i = 0; i < intervals.length; i++) { 86 + clearInterval(intervals[i]) 87 + } 88 + intervals = [] 89 + 90 + for (let i = 0; i < store.instances.length; i++) { 91 + const instance = store.instances[i] 92 + const intervalTime = instance.minutesBetweenRefreshes*1000*60 93 + await refresh(instance, limit) 94 + const interval = setInterval(refresh, intervalTime, instance) 95 + intervals.push(interval) 96 + } 97 + } 98 + module.exports.restartIntervals() 99 + 100 + async function refresh(instance, limit) { 83 101 try { 84 102 const channelCount = instance.channels.length 85 103 const queries = [] ··· 310 328 }) 311 329 } 312 330 313 - module.exports.restartIntervals = async function() { 314 - for (let i = 0; i < intervals.length; i++) { 315 - clearInterval(intervals[i]) 316 - } 317 - intervals = [] 318 - 319 - for (let i = 0; i < store.instances.length; i++) { 320 - const instance = store.instances[i] 321 - const intervalTime = instance.minutesBetweenRefreshes*1000*60 322 - await refresh(instance) 323 - const interval = setInterval(refresh, intervalTime, instance) 324 - intervals.push(interval) 325 - } 326 - } 327 - module.exports.restartIntervals() 328 - 329 331 const wss = new WebSocket.Server({ noServer: true }) 330 332 let connection = null 331 333 let serverCloseTimeout = null ··· 385 387 minutesBetweenRefreshes: data.minutesBetweenRefreshes, 386 388 channels: [], 387 389 }) 390 + module.exports.restartIntervals() 388 391 storeUpdate() 389 392 390 393 } else if (type === 'editEmail') { 391 394 const instance = store.instances[data.instanceIndex] 392 395 instance.email = data.email 393 - instance.minutesBetweenRefreshes = data.minutesBetweenRefreshes 396 + if (instance.minutesBetweenRefreshes !== data.minutesBetweenRefreshes) { 397 + instance.minutesBetweenRefreshes = data.minutesBetweenRefreshes 398 + module.exports.restartIntervals() 399 + } 394 400 storeUpdate() 395 401 396 402 } else if (type === 'deleteEmail') { 397 403 store.instances.splice(data.instanceIndex, 1) 404 + module.exports.restartIntervals() 398 405 storeUpdate() 399 406 400 407 } else if (type === 'addChannel') {