@@ -119,6 +119,7 @@ let contentRatings;
119
119
let oldAwtrixApps = [ ] ;
120
120
let isAwtrixEnabled = false ;
121
121
let awtrixIP = "" ;
122
+ let restartSeconds = 86400000 ; //60000; //
122
123
123
124
// create working folders if they do not exist
124
125
// needed for package binaries
@@ -128,6 +129,7 @@ const { titleColour, enableSleep, sleepStart, sleepEnd, numberOnDemand } = requi
128
129
const CardType = require ( "./classes/cards/CardType" ) ;
129
130
const MediaCard = require ( "./classes/cards/MediaCard" ) ;
130
131
const Links = require ( "./classes/custom/links" ) ;
132
+ const { now } = require ( "jquery" ) ;
131
133
132
134
var dir = './config' ;
133
135
@@ -864,13 +866,9 @@ async function loadOnDemand() {
864
866
* @returns nothing
865
867
*/
866
868
async function houseKeeping ( ) {
867
- // stop the clock
868
- clearInterval ( houseKeepingClock ) ;
869
869
// clean cache
870
870
await core . DeleteMP3Cache ( ) ;
871
871
await core . DeleteImageCache ( ) ;
872
- // restart timer
873
- houseKeepingClock = setInterval ( houseKeeping , 86400000 ) ; // daily
874
872
}
875
873
876
874
/*
@@ -1071,6 +1069,9 @@ async function checkEnabled() {
1071
1069
sleepRange = "" ;
1072
1070
}
1073
1071
1072
+ // calculate daily restart time
1073
+ let timeObject = new Date ( Date . now ( ) + restartSeconds ) ;
1074
+
1074
1075
console . log (
1075
1076
`--- Enabled Status ---
1076
1077
Plex: ` +
@@ -1103,7 +1104,10 @@ async function checkEnabled() {
1103
1104
Trivia: ` +
1104
1105
isTriviaEnabled +
1105
1106
`
1106
- `
1107
+ Daily restart commencing at: ` +
1108
+ timeObject . toLocaleTimeString ( ) +
1109
+ `
1110
+ `
1107
1111
) ;
1108
1112
return ;
1109
1113
}
@@ -1199,7 +1203,11 @@ async function startup(clearCache) {
1199
1203
linkCards = [ ] ;
1200
1204
1201
1205
// run housekeeping job
1202
- if ( clearCache !== false ) await houseKeeping ( ) ;
1206
+ if ( clearCache !== false ) {
1207
+ await houseKeeping ( ) ;
1208
+ // let d = new Date();
1209
+ // console.log(d.toLocaleString() + ` ** Restart/reload **`);
1210
+ }
1203
1211
// TODO to remove this! console.log(clearCache);
1204
1212
// load settings object
1205
1213
loadedSettings = await Promise . resolve ( await loadSettings ( ) ) ;
@@ -1214,7 +1222,7 @@ async function startup(clearCache) {
1214
1222
globalPage . hideSettingsLinks = loadedSettings . hideSettingsLinks !== undefined ? loadedSettings . hideSettingsLinks : 'false' ;
1215
1223
1216
1224
// restart timer for houseKeeping
1217
- houseKeepingClock = setInterval ( houseKeeping , 86400000 ) ; // daily
1225
+ // houseKeepingClock = setInterval(houseKeeping, 86400000); // daily
1218
1226
}
1219
1227
1220
1228
// check status
@@ -1370,6 +1378,9 @@ async function startup(clearCache) {
1370
1378
clearInterval ( sleepClock ) ;
1371
1379
sleep = "false" ;
1372
1380
}
1381
+ // restart timer
1382
+ houseKeepingClock = setInterval ( startup , restartSeconds ) ; // daily
1383
+
1373
1384
return ;
1374
1385
}
1375
1386
0 commit comments