Skip to content

Commit

Permalink
Merge branch 'decentraland:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmahidalgo authored Nov 27, 2024
2 parents 1112d14 + c394f9c commit 0d92de9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/polygon/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ let bytesRead = 0; // amount of bytes received
const preloadedCollections = loadCollections().addresses;
const preloadedCollectionsHeight = loadCollections().height;
const collectionsCreatedByFactory = new Set<string>();
const collectionIdsNotIncludedInPreloaded = new Set<string>();

processor.run(
new TypeormDatabase({
Expand All @@ -99,15 +100,6 @@ processor.run(
.find(Rarity)
.then((q) => new Map(q.map((i) => [i.id, i])));

const collectionIdsNotIncludedInPreloaded = await ctx.store
.find(Collection, {
where: {
id: Not(In(preloadedCollections)),
network: ModelNetwork.POLYGON,
},
})
.then((q) => new Set(q.map((c) => c.id)));

const isThereImportantDataInBatch = ctx.blocks.some((block) =>
block.logs.some(
(log) =>
Expand Down Expand Up @@ -924,6 +916,13 @@ processor.run(

console.time("about to upsert");

// add new collections to the list of ids from the not preloaded
storedData.collections.forEach((collection) => {
if (!preloadedCollections.includes(collection.id)) {
collectionIdsNotIncludedInPreloaded.add(collection.id);
}
});

await ctx.store.upsert([...rarities.values()]);
for (const [key, value] of Object.entries(storedData)) {
if (
Expand Down

0 comments on commit 0d92de9

Please sign in to comment.