From 5ed7b1b4db81a7ebfbc502830cc307794414375d Mon Sep 17 00:00:00 2001 From: Niels Maerten Date: Sat, 4 Jul 2020 17:04:03 +0200 Subject: [PATCH] Remove glucoseWatcher lock --- assets/advanced-installer-project/Glucose Ticker.aip | 4 ++-- package.json | 3 ++- src/electron-app/components/glucose-watcher.ts | 6 ------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/assets/advanced-installer-project/Glucose Ticker.aip b/assets/advanced-installer-project/Glucose Ticker.aip index d1ce5f2..f52e6a1 100644 --- a/assets/advanced-installer-project/Glucose Ticker.aip +++ b/assets/advanced-installer-project/Glucose Ticker.aip @@ -13,10 +13,10 @@ - + - + diff --git a/package.json b/package.json index ccc74a0..62783fa 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "scripts": { "format": "prettier --write src/**/*", "start": "yarn run build:ts && electron .", - "build:app": "yarn run build:ts && electron-builder --dir", + "build:app:unpacked": "yarn run build:ts && electron-builder --dir", + "build:app:portable": "yarn run build:ts && electron-builder", "build:ts": "yarn run clean && tsc --project tsconfig.json && rollup --config && rimraf tmp/tsc/package.json", "clean": "rimraf out && rimraf tmp && rimraf dist" }, diff --git a/src/electron-app/components/glucose-watcher.ts b/src/electron-app/components/glucose-watcher.ts index 7a08721..439eb16 100644 --- a/src/electron-app/components/glucose-watcher.ts +++ b/src/electron-app/components/glucose-watcher.ts @@ -12,7 +12,6 @@ export default class GlucoseWatcher { return this._instance; } - private lock: boolean = false; private nightscoutAPI!: NightscoutAPI; private currentGlucose!: GlucoseStatus; private settings!: AppSettings; @@ -60,17 +59,12 @@ export default class GlucoseWatcher { // Bail if: API not initialized if (!this.nightscoutAPI) return; - // Bail if: other cron job is currently running - if (this.lock) return; - else this.lock = true; - console.log("Fetching new glucose value"); this.currentGlucose = await this.nightscoutAPI.getCurrentStatus(); // Refresh the app's icon const icon = new AppIcon(this.settings, this.currentGlucose); AppState.mainWindow.setIcon(await icon.toNativeImage()); - this.lock = false; }; }