fix: prevent double asset update
This commit is contained in:
+17
-4
@@ -39,11 +39,24 @@ const font = file(fontFile);
|
||||
const iconFont = file(iconFontFile);
|
||||
const shade = file(shadeSvg);
|
||||
|
||||
queueMicrotask(async () => {
|
||||
assets.getMissingAssets();
|
||||
var purging = false;
|
||||
|
||||
setInterval(() => {
|
||||
assets.getMissingAssets();
|
||||
queueMicrotask(() => {
|
||||
if (purging) return;
|
||||
purging = true;
|
||||
assets.getMissingAssets().finally(() => (purging = false));
|
||||
|
||||
setInterval(async () => {
|
||||
if (purging) return;
|
||||
purging = true;
|
||||
try {
|
||||
await assets.getMissingAssets();
|
||||
await assets.purgeExtraAssets();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} finally {
|
||||
purging = false;
|
||||
}
|
||||
}, 86400000); // refresh assets every 24 hours
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user