Update more aggressively processes on relay notifications
This commit is contained in:
parent
bde2ed0e44
commit
b6c2d211e5
@ -1059,10 +1059,21 @@ export default class Services {
|
||||
for (const [processId, process] of Object.entries(newProcesses)) {
|
||||
const existing = await this.getProcess(processId);
|
||||
if (existing) {
|
||||
// We check if we have public_data on the first state
|
||||
if (Object.keys(process.states[0].public_data).length != 0) {
|
||||
await this.saveProcessToDb(processId, process as Process);
|
||||
const event = new CustomEvent('process-updated', {
|
||||
detail: { processId }
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
continue;
|
||||
}
|
||||
const lastKnownCommitment = this.getLastCommitedState(existing);
|
||||
const newLastCommitment = this.getLastCommitedState(process);
|
||||
if (!lastKnownCommitment || !newLastCommitment) { continue }
|
||||
if (lastKnownCommitment.commited_in !== newLastCommitment.commited_in) {
|
||||
// Update the process in db with the new one
|
||||
await this.saveProcessToDb(processId, process as Process);
|
||||
console.log('Dispatching process-updated event');
|
||||
const event = new CustomEvent('process-updated', {
|
||||
detail: { processId }
|
||||
|
Loading…
x
Reference in New Issue
Block a user