Skip to content

Commit

Permalink
fix Compact Database
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 4, 2024
1 parent 2ac342e commit 8e531e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Envox <[email protected]>",
"description": "Cross-platform visual development tool and SCPI instrument controller",
"homepage": "https://www.envox.hr/eez/studio/studio-introduction.html",
"version": "0.19.0",
"version": "0.20.0",
"revision": "1",
"license": "GPL-3.0-only",
"repository": "https://github.com/eez-open/studio",
Expand Down
16 changes: 8 additions & 8 deletions packages/home/settings.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from "fs";
import { ipcRenderer, shell, clipboard } from "electron";
import { dialog, getCurrentWindow } from "@electron/remote";
import { confirm } from "eez-studio-ui/dialog-electron";
Expand Down Expand Up @@ -390,12 +391,12 @@ class SettingsController {
}
};

compactDatabase() {
compactDatabase = () => {
if (!this.selectedDatabase) {
return;
}
showDialog(<CompactDatabaseDialog database={this.selectedDatabase} />);
}
};
}

export const settingsController = new SettingsController();
Expand All @@ -419,18 +420,17 @@ const CompactDatabaseDialog = observer(
sizeReduced: observable
});

var fs = require("fs");
this.sizeBefore = fs.statSync(
this.props.database.databaseSize
).size;
this.sizeBefore = fs.statSync(this.props.database.filePath).size;
}

async componentDidMount() {
try {
await dbVacuum();

this.props.database.timeOfLastDatabaseCompactOperation =
Date.now();
runInAction(() => {
this.props.database.timeOfLastDatabaseCompactOperation =
Date.now();
});

runInAction(() => {
var fs = require("fs");
Expand Down

0 comments on commit 8e531e2

Please sign in to comment.