Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async function processEventNft({event, chainName}) {
await putRedisItem(ids.lastCachedBlockNft, {
id: ids.lastCachedBlockNft,
number: blockNumber,
}, redisPrefixes.mainnetsidechainNft);
}, redisPrefixes[chainName + 'Nft']);
}

async function processEventsNft({events, currentBlockNumber, chainName}) {
Expand Down Expand Up @@ -299,11 +299,11 @@ async function processEventsNft({events, currentBlockNumber, chainName}) {
await putRedisItem(tokenId, token, redisPrefixes.mainnetsidechainNft);
}
}

await putRedisItem(ids.lastCachedBlockNft, {
id: ids.lastCachedBlockNft,
number: currentBlockNumber,
}, redisPrefixes.mainnetsidechainNft);
}, redisPrefixes[chainName + 'Nft']);
}

async function processEventAccount({contract, event, chainName}) {
Expand All @@ -317,19 +317,19 @@ async function processEventAccount({contract, event, chainName}) {
address: owner,
chainName,
});

// console.log('load account into cache', owner, account);

// if (token.properties.hash) {
await putRedisItem(owner, account, redisPrefixes.mainnetsidechainAccount);
await putRedisItem(owner, account, redisPrefixes.mainnetsidechainAccount);
// }
} catch (e) {
console.error(e);
}
}

const {blockNumber} = event;
await putRedisItem(ids.lastCachedBlockAccount, {number: blockNumber}, redisPrefixes.mainnetsidechainAccount);
await putRedisItem(ids.lastCachedBlockAccount, {number: blockNumber}, redisPrefixes[chainName + 'Account']);
}
const _uniquify = (a, pred = (a, b) => a === b) => {
return a.filter((e, i) => {
Expand All @@ -356,10 +356,10 @@ async function processEventsAccount({contract, events, currentBlockNumber, chain
});
await putRedisItem(owner, account, redisPrefixes.mainnetsidechainAccount);
}
await putRedisItem(ids.lastCachedBlockAccount, {number: currentBlockNumber}, redisPrefixes.mainnetsidechainAccount);

await putRedisItem(ids.lastCachedBlockAccount, {number: currentBlockNumber}, redisPrefixes[chainName + 'Account']);
}

module.exports = {
initCaches,
};
};