Restore from processes obtained from relay
This commit is contained in:
parent
fa3eaeb511
commit
b9af99cd02
@ -806,9 +806,16 @@ export default class Services {
|
|||||||
const initMsg: InitMessage = JSON.parse(parsedMsg);
|
const initMsg: InitMessage = JSON.parse(parsedMsg);
|
||||||
this.updateRelay(url, initMsg.sp_address);
|
this.updateRelay(url, initMsg.sp_address);
|
||||||
const processes: [string, Process][] = JSON.parse(initMsg.processes_list!);
|
const processes: [string, Process][] = JSON.parse(initMsg.processes_list!);
|
||||||
|
// Write processes to db
|
||||||
|
const record = processes.reduce((record, [outPoint, process]) => {
|
||||||
|
record[outPoint] = process;
|
||||||
|
return record;
|
||||||
|
}, {} as Record<string, Process>);
|
||||||
|
setTimeout(async () => {
|
||||||
|
await this.restoreProcessesFromBackUp(record);
|
||||||
|
}, 500)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to parse init message:', parsedMsg);
|
console.error('Failed to parse init message:', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user