Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"dnd-core": "^16.0.1",
"dotenv": "^17.3.1",
"drizzle-orm": "0.45.1",
"electron-updater": "^6.7.3",
"electron-updater": "^6.8.3",
"execa": "^9.6.0",
"express": "^5.1.0",
"fast-glob": "^3.3.3",
Expand Down
21 changes: 21 additions & 0 deletions apps/desktop/src/main/lib/auto-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ import { prerelease } from "semver";
import { AUTO_UPDATE_STATUS, type AutoUpdateStatus } from "shared/auto-update";
import { PLATFORM } from "shared/constants";

// electron-updater's internal cache only self-invalidates when the remote
// sha512 differs from cached metadata, so a corrupt cached download (e.g.
// failed Squirrel install) gets retried indefinitely until the user
// manually reinstalls. Reach into the protected helper to clear it.
interface AppUpdaterInternals {
downloadedUpdateHelper: { clear(): Promise<void> } | null;
}

async function clearCachedUpdate(reason: string): Promise<void> {
const helper = (autoUpdater as unknown as AppUpdaterInternals)
.downloadedUpdateHelper;
if (!helper) return;
try {
await helper.clear();
console.info(`[auto-updater] Cleared cached update (${reason})`);
} catch (error) {
console.error("[auto-updater] Failed to clear cached update:", error);
}
}

const UPDATE_CHECK_INTERVAL_MS = 1000 * 60 * 60 * 4; // 4 hours

/**
Expand Down Expand Up @@ -231,6 +251,7 @@ export function setupAutoUpdater(): void {
`[auto-updater] Error during update (currentVersion=${app.getVersion()}):`,
error?.message || error,
);
void clearCachedUpdate(`error: ${error?.message ?? "unknown"}`);
emitStatus(AUTO_UPDATE_STATUS.ERROR, undefined, error.message);
});

Expand Down
2 changes: 1 addition & 1 deletion bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading