This commit is contained in:
1 parent
1ff552fc40
commit
fae1c3a3de
1 file changed
+3
-1
+3
-1
@@ -14,6 +14,7 @@ class McpUpdate {
|
|||||||
this.writes = Promise.resolve();
|
this.writes = Promise.resolve();
|
||||||
this.task = null;
|
this.task = null;
|
||||||
this.resumeTask = null;
|
this.resumeTask = null;
|
||||||
|
this.recoveryJobId = null;
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
}
|
}
|
||||||
async load() {
|
async load() {
|
||||||
@@ -28,6 +29,7 @@ class McpUpdate {
|
|||||||
if (error.code !== 'ENOENT') throw new McpAccessError('UPDATE_STORE_UNAVAILABLE');
|
if (error.code !== 'ENOENT') throw new McpAccessError('UPDATE_STORE_UNAVAILABLE');
|
||||||
}
|
}
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
|
this.recoveryJobId = this.active()?.id || null;
|
||||||
}
|
}
|
||||||
async save() {
|
async save() {
|
||||||
const data = JSON.stringify({ version: 1, jobs: this.jobs });
|
const data = JSON.stringify({ version: 1, jobs: this.jobs });
|
||||||
@@ -137,7 +139,7 @@ class McpUpdate {
|
|||||||
async recover({ rendererReady, connected }) {
|
async recover({ rendererReady, connected }) {
|
||||||
if (!this.ready || this.task || this.resumeTask || !rendererReady) return;
|
if (!this.ready || this.task || this.resumeTask || !rendererReady) return;
|
||||||
const job = this.active();
|
const job = this.active();
|
||||||
if (!job) return;
|
if (!job || job.id !== this.recoveryJobId) return;
|
||||||
this.resumeTask = (async () => {
|
this.resumeTask = (async () => {
|
||||||
if (job.phase === 'awaiting_reconnect') {
|
if (job.phase === 'awaiting_reconnect') {
|
||||||
if (connected) await this.phase(job, 'completed', { completedAt: Date.now(), reconnectedAt: Date.now() });
|
if (connected) await this.phase(job, 'completed', { completedAt: Date.now(), reconnectedAt: Date.now() });
|
||||||
|
|||||||
Reference in new issue
Block a user