minor bug fixes: ensure the download completely fully, ensure a new resource monitor is launched if a cached one was removed

This commit is contained in:
Egor 2025-11-27 12:44:22 -08:00
parent 4c679283ea
commit 7a118c9449
6 changed files with 39 additions and 12 deletions

View file

@ -1,7 +1,7 @@
{
"name": "gerbil",
"productName": "Gerbil",
"version": "1.12.0",
"version": "1.12.1",
"description": "Run Large Language Models locally",
"main": "out/main/index.js",
"homepage": "./",
@ -60,7 +60,7 @@
"eslint-plugin-sonarjs": "^3.0.5",
"globals": "^16.5.0",
"jiti": "^2.6.1",
"prettier": "^3.6.2",
"prettier": "^3.7.1",
"rollup-plugin-visualizer": "^6.0.5",
"typescript": "^5.9.3",
"vite": "^7.2.4"

View file

@ -48,8 +48,8 @@ export const DownloadCard = ({
: 0;
const hasVersionMismatch = Boolean(
versionInfo.version &&
versionInfo.actualVersion &&
versionInfo.version !== versionInfo.actualVersion
versionInfo.actualVersion &&
versionInfo.version !== versionInfo.actualVersion
);
// eslint-disable-next-line sonarjs/cognitive-complexity

View file

@ -97,8 +97,8 @@ export const VersionsTab = () => {
const isCurrent = Boolean(
installedVersion &&
currentVersion &&
currentVersion.path === installedVersion.path
currentVersion &&
currentVersion.path === installedVersion.path
);
if (installedVersion) {

View file

@ -80,7 +80,13 @@ async function downloadFile(
let isAborted = false;
const cleanup = async () => {
fileStream?.close();
await new Promise<void>((resolve) => {
if (fileStream) {
fileStream.close(() => resolve());
} else {
resolve();
}
});
await unlink(tempPath).catch(() => void 0);
};
@ -188,6 +194,18 @@ async function downloadFile(
response.on('end', () => {
if (isAborted) return;
if (totalBytes > 0 && downloadedBytes !== totalBytes) {
activeDownloads.delete(abortController);
cleanup();
reject(
new Error(
`Incomplete download: received ${downloadedBytes} bytes, expected ${totalBytes} bytes`
)
);
return;
}
fileStream.end();
fileStream.on('finish', async () => {
try {

View file

@ -269,6 +269,15 @@ export const openPerformanceManager = async () =>
if (success) {
return { success: true, app };
}
cachedLinuxApp = null;
linuxAppSearchComplete = false;
const fallbackApp = await findLinuxPerformanceApp();
if (fallbackApp) {
const fallbackSuccess = await tryLaunchCommand(fallbackApp);
if (fallbackSuccess) {
return { success: true, app: fallbackApp };
}
}
}
return {
success: false,

View file

@ -3736,7 +3736,7 @@ __metadata:
jiti: "npm:^2.6.1"
lucide-react: "npm:^0.555.0"
mime-types: "npm:^3.0.2"
prettier: "npm:^3.6.2"
prettier: "npm:^3.7.1"
react: "npm:^19.2.0"
react-dom: "npm:^19.2.0"
react-error-boundary: "npm:^6.0.0"
@ -5506,12 +5506,12 @@ __metadata:
languageName: node
linkType: hard
"prettier@npm:^3.6.2":
version: 3.6.2
resolution: "prettier@npm:3.6.2"
"prettier@npm:^3.7.1":
version: 3.7.1
resolution: "prettier@npm:3.7.1"
bin:
prettier: bin/prettier.cjs
checksum: 10c0/488cb2f2b99ec13da1e50074912870217c11edaddedeadc649b1244c749d15ba94e846423d062e2c4c9ae683e2d65f754de28889ba06e697ac4f988d44f45812
checksum: 10c0/a6610043ee0a64a3251a948bf82fad3e59d984a8e8dea206400cfa190585417e3343b32c1f6ae7d8f40798a9b4bd91affc08fa7795dd99a9dec5c9bccdf31500
languageName: node
linkType: hard