Skip to content

Commit 264f4c1

Browse files
committed
feat(updater): Refresh for each check.
1 parent cf054c3 commit 264f4c1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/updater.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ export default class AutoUpdater {
112112
clearInterval(this.timer);
113113
}
114114
this.timer = setInterval(async () => {
115-
if (this.updateInfo?.updateVersion) {
116-
this.timer && clearInterval(this.timer)
117-
return;
118-
}
119115
const info = await this.update(true)
120116
if (typeof info === 'boolean') {
121117
return;
@@ -128,14 +124,18 @@ export default class AutoUpdater {
128124
}, CheckInterval)
129125
}
130126
async update(seeIfUpdatedOnly = false, specifyVersion = "") {
127+
const refresh = async () => {
128+
const resp = await this.updatePlugin(this.githubPath, seeIfUpdatedOnly, specifyVersion);
129+
if (resp && (typeof resp !== 'boolean')) {
130+
this.updateInfo = resp;
131+
}
132+
return resp;
133+
}
131134
if (seeIfUpdatedOnly && this.updateInfo?.updateVersion) {
135+
refresh();
132136
return this.updateInfo;
133137
}
134-
const resp = await this.updatePlugin(this.githubPath, seeIfUpdatedOnly, specifyVersion);
135-
if (resp && (typeof resp !== 'boolean')) {
136-
this.updateInfo = resp;
137-
}
138-
return resp;
138+
return refresh();
139139
}
140140
/**
141141
* Primary function for adding a new beta plugin to Obsidian.

0 commit comments

Comments
 (0)