Skip to content

Commit

Permalink
Removed use of promise
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterbrandsen authored Mar 20, 2024
1 parent 3cc7eb8 commit f61ff98
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/data/broker/processData.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export default class ProcessDataBroker {
objects: {}
}
}
const firstTickObjectsPromises = firstTickObjects.map(async ([id, firstTickObject]) => {

for (let o = 0; o < firstTickObjects.length; o += 1) {
const id = firstTickObjects[o][0];
const firstTickObject = firstTickObjects[o][1];
if (opts.userId === firstTickObject.user || opts.type === "unknown") {
const uniqueObject = cleanSource(firstTickObject);
uniqueObjects[id] = uniqueObject;
Expand All @@ -65,15 +68,12 @@ export default class ProcessDataBroker {
data.ticks[tick].objects[id] = object;
}
}
})
await Promise.all(firstTickObjectsPromises);
}

const summarizeObjectPromises = Array.from({ length: 100 }, (_, t) => {
for (let t = 0; t < 100; t += 1) {
const tick = tickKeys[t];
if (tick) data.ticks[tick].summarize = summarizeObjects(data.ticks[tick].objects);
return Promise.resolve();
});
await Promise.all(summarizeObjectPromises);
}

data.uniqueObjects = uniqueObjects
return data
Expand Down

0 comments on commit f61ff98

Please sign in to comment.