Skip to content

Commit c9fe21c

Browse files
committed
fix reload of images after daily cache clear
1 parent 1df24ac commit c9fe21c

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

index.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ let contentRatings;
119119
let oldAwtrixApps = [];
120120
let isAwtrixEnabled = false;
121121
let awtrixIP = "";
122+
let restartSeconds = 86400000; //60000; //
122123

123124
// create working folders if they do not exist
124125
// needed for package binaries
@@ -128,6 +129,7 @@ const { titleColour, enableSleep, sleepStart, sleepEnd, numberOnDemand } = requi
128129
const CardType = require("./classes/cards/CardType");
129130
const MediaCard = require("./classes/cards/MediaCard");
130131
const Links = require("./classes/custom/links");
132+
const { now } = require("jquery");
131133

132134
var dir = './config';
133135

@@ -864,13 +866,9 @@ async function loadOnDemand() {
864866
* @returns nothing
865867
*/
866868
async function houseKeeping() {
867-
// stop the clock
868-
clearInterval(houseKeepingClock);
869869
// clean cache
870870
await core.DeleteMP3Cache();
871871
await core.DeleteImageCache();
872-
// restart timer
873-
houseKeepingClock = setInterval(houseKeeping, 86400000); // daily
874872
}
875873

876874
/*
@@ -1071,6 +1069,9 @@ async function checkEnabled() {
10711069
sleepRange = "";
10721070
}
10731071

1072+
// calculate daily restart time
1073+
let timeObject = new Date(Date.now() + restartSeconds);
1074+
10741075
console.log(
10751076
`--- Enabled Status ---
10761077
Plex: ` +
@@ -1103,7 +1104,10 @@ async function checkEnabled() {
11031104
Trivia: ` +
11041105
isTriviaEnabled +
11051106
`
1106-
`
1107+
Daily restart commencing at: ` +
1108+
timeObject.toLocaleTimeString() +
1109+
`
1110+
`
11071111
);
11081112
return;
11091113
}
@@ -1199,7 +1203,11 @@ async function startup(clearCache) {
11991203
linkCards = [];
12001204

12011205
// 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+
}
12031211
// TODO to remove this! console.log(clearCache);
12041212
// load settings object
12051213
loadedSettings = await Promise.resolve(await loadSettings());
@@ -1214,7 +1222,7 @@ async function startup(clearCache) {
12141222
globalPage.hideSettingsLinks = loadedSettings.hideSettingsLinks !== undefined ? loadedSettings.hideSettingsLinks : 'false';
12151223

12161224
// restart timer for houseKeeping
1217-
houseKeepingClock = setInterval(houseKeeping, 86400000); // daily
1225+
//houseKeepingClock = setInterval(houseKeeping, 86400000); // daily
12181226
}
12191227

12201228
// check status
@@ -1370,6 +1378,9 @@ async function startup(clearCache) {
13701378
clearInterval(sleepClock);
13711379
sleep = "false";
13721380
}
1381+
// restart timer
1382+
houseKeepingClock = setInterval(startup, restartSeconds); // daily
1383+
13731384
return;
13741385
}
13751386

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posterr",
3-
"version": "1.18.1",
3+
"version": "1.18.3",
44
"description": "A digital display for your media",
55
"main": "index.js",
66
"bin": "index.js",

0 commit comments

Comments
 (0)