mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-06 11:36:58 +03:00
Don't update multiple times
This commit is contained in:
@@ -52,6 +52,7 @@ if (tables.length === 0) {
|
||||
|
||||
let lastUpdate = 0;
|
||||
let updateQueued = false;
|
||||
let updateRunning = false;
|
||||
|
||||
function removeOutdatedDumps(exportPath: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -185,8 +186,9 @@ function updateQueueTime(): void {
|
||||
}
|
||||
|
||||
async function queueDump(): Promise<void> {
|
||||
if (updateQueued) {
|
||||
if (updateQueued && !updateRunning) {
|
||||
lastUpdate = Date.now();
|
||||
updateRunning = true;
|
||||
|
||||
await removeOutdatedDumps(appExportPath);
|
||||
|
||||
@@ -205,5 +207,6 @@ async function queueDump(): Promise<void> {
|
||||
latestDumpFiles = [...dumpFiles];
|
||||
|
||||
updateQueued = false;
|
||||
updateRunning = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user