Minor improvements in the worker
This commit is contained in:
parent
57684eba6b
commit
682ab03861
@ -32,13 +32,10 @@ self.addEventListener('message', async (event) => {
|
|||||||
|
|
||||||
// Iterate on each process
|
// Iterate on each process
|
||||||
if (myProcesses && myProcesses.length != 0) {
|
if (myProcesses && myProcesses.length != 0) {
|
||||||
console.log(myProcesses);
|
|
||||||
for (const process of myProcesses) {
|
for (const process of myProcesses) {
|
||||||
console.log(process);
|
|
||||||
// Iterate on states
|
// Iterate on states
|
||||||
for (const state of process.states) {
|
for (const state of process.states) {
|
||||||
if (!state.pcd_commitment) continue;
|
if (!state.pcd_commitment) continue;
|
||||||
console.log(state);
|
|
||||||
// iterate on pcd_commitment
|
// iterate on pcd_commitment
|
||||||
for (const hash of Object.values(state.pcd_commitment)) {
|
for (const hash of Object.values(state.pcd_commitment)) {
|
||||||
// Check if we have the data in db
|
// Check if we have the data in db
|
||||||
@ -49,8 +46,9 @@ self.addEventListener('message', async (event) => {
|
|||||||
await addDiff(process, state, hash)
|
await addDiff(process, state, hash)
|
||||||
} else {
|
} else {
|
||||||
// We remove it if we have it in the set
|
// We remove it if we have it in the set
|
||||||
console.log(`Removing ${hash} from the set`);
|
if (toDownload.delete(hash)) {
|
||||||
toDownload.delete(hash);
|
console.log(`Removing ${hash} from the set`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,7 +258,6 @@ async function addDiff(processId, stateId, hash) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!existingDiff) {
|
if (!existingDiff) {
|
||||||
console.log('Inserting a diff');
|
|
||||||
const newDiff = {
|
const newDiff = {
|
||||||
process_id: processId,
|
process_id: processId,
|
||||||
state_id: stateId,
|
state_id: stateId,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user