Skip to content

Commit 76c414c

Browse files
committed
Fix mod updates not being checked on start
1 parent dd5c12a commit 76c414c

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

frontend/src/lib/store/ficsitCLIStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { binding, bindingTwoWay } from './wailsStoreBindings';
66

77
import { queuedMods } from '$lib/store/actionQueue';
88
import { bytesToAppropriate, secondsToAppropriate } from '$lib/utils/dataFormats';
9+
import { setIntervalImmediate } from '$lib/utils/interval';
910
import { progressStats } from '$lib/utils/progress';
1011
import {
1112
CheckForUpdates,
@@ -80,6 +81,7 @@ export const unignoredUpdates = derived([updates, ignoredUpdates], ([$updates, $
8081
export const updateCheckInProgress = writable(false);
8182

8283
export async function checkForUpdates() {
84+
if (get(updateCheckInProgress)) return;
8385
updateCheckInProgress.set(true);
8486
try {
8587
const result = await CheckForUpdates();
@@ -89,7 +91,7 @@ export async function checkForUpdates() {
8991
}
9092
}
9193

92-
setInterval(() => checkForUpdates().catch(console.error), 1000 * 60 * 5); // Check for updates every 5 minutes
94+
setIntervalImmediate(() => checkForUpdates().catch(console.error), 1000 * 60 * 5); // Check for updates every 5 minutes
9395

9496
export const progressTitle = derived(progress, ($progress) => {
9597
if (!$progress) return '';

frontend/src/lib/utils/interval.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export function setIntervalImmediate(handler: () => void, timeout: number): ReturnType<typeof setInterval> {
2+
handler();
3+
return setInterval(handler, timeout);
4+
}

0 commit comments

Comments
 (0)