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