Skip to content

Commit c6a38e0

Browse files
committed
add cache invalidation. fix kriskbx#29
1 parent 6c72c8c commit c6a38e0

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"electron-compile": "^6.4.2",
126126
"electron-log": "^2.2.14",
127127
"electron-squirrel-startup": "^1.0.0",
128-
"gitlab-time-tracker": "^1.7.25",
128+
"gitlab-time-tracker": "^1.7.37",
129129
"moment": "^2.20.1",
130130
"raven": "^2.6.2",
131131
"write-yaml": "^1.0.0"

src/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,9 @@ gtt.writeConfig = (config) => {
442442
* Cache wrapper.
443443
*/
444444
gtt.cache = {
445+
delete: (key) => gtt._config.cache.delete(key),
445446
get: (key) => gtt._config.cache.get(key),
446-
set: (key, value) => gtt._config.cache.set(key, value)
447+
set: (key, value) => gtt._config.cache.set(key, value),
447448
};
448449

449450
/**
@@ -630,7 +631,12 @@ ipcMain.on('context-menu', () => {
630631
gtt.openContextMenu();
631632
});
632633
ipcMain.on('cache-get', (event, key) => {
633-
event.returnValue = gtt.cache.get(key);
634+
try {
635+
event.returnValue = gtt.cache.get(key);
636+
} catch(e) {
637+
gtt.cache.delete(key);
638+
event.returnValue = null;
639+
}
634640
});
635641
ipcMain.on('cache-set', (event, {key, data}) => {
636642
gtt.cache.set(key, data);

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4705,9 +4705,9 @@ gifsicle@^3.0.0:
47054705
bin-wrapper "^3.0.0"
47064706
logalot "^2.0.0"
47074707

4708-
gitlab-time-tracker@^1.7.25:
4709-
version "1.7.35"
4710-
resolved "https://registry.yarnpkg.com/gitlab-time-tracker/-/gitlab-time-tracker-1.7.35.tgz#c267d20df1ebdd74fd075bfa68e7cbab0980f9ae"
4708+
gitlab-time-tracker@^1.7.37:
4709+
version "1.7.37"
4710+
resolved "https://registry.yarnpkg.com/gitlab-time-tracker/-/gitlab-time-tracker-1.7.37.tgz#3d06e8a25ab311ac0d733b0b48fe5dcc4060ccfa"
47114711
dependencies:
47124712
app-module-path "^2.2.0"
47134713
async "^2.6.1"

0 commit comments

Comments
 (0)