Skip to content

Commit

Permalink
Remove glucoseWatcher lock
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsmaerten committed Jul 4, 2020
1 parent 1994a60 commit 5ed7b1b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions assets/advanced-installer-project/Glucose Ticker.aip
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
<ROW Property="ARPURLUPDATEINFO" Value="https://github.com/nielsmaerten/glucose-ticker/releases"/>
<ROW Property="LIMITUI" MultiBuildValue="DefaultBuild:1"/>
<ROW Property="Manufacturer" Value="Diabase.app"/>
<ROW Property="ProductCode" Value="1033:{0BCB1E54-FF2A-4D96-AB02-1BD510E936B6} " Type="16"/>
<ROW Property="ProductCode" Value="1033:{695DED02-44F4-4B3C-8B7C-5B42716ADC19} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Glucose Ticker"/>
<ROW Property="ProductVersion" Value="0.4.1.0" Type="32" TargetFile="GlucoseTicker.exe"/>
<ROW Property="ProductVersion" Value="0.4.2.0" Type="32" TargetFile="GlucoseTicker.exe"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
<ROW Property="UpgradeCode" Value="{B3CA8132-2343-49AE-89AF-440536B1E8DA}"/>
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 0 additions & 6 deletions src/electron-app/components/glucose-watcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default class GlucoseWatcher {
return this._instance;
}

private lock: boolean = false;
private nightscoutAPI!: NightscoutAPI;
private currentGlucose!: GlucoseStatus;
private settings!: AppSettings;
Expand Down Expand Up @@ -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;
};
}

Expand Down

0 comments on commit 5ed7b1b

Please sign in to comment.