Skip to content

Commit

Permalink
Search in a set should be done differently
Browse files Browse the repository at this point in the history
  • Loading branch information
Inkvi committed Mar 12, 2024
1 parent bb9d318 commit ed43a12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/api/cache/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export async function GET(request: NextRequest) {
// Set cache concurrently
await Promise.all([
cache.set('allChannels', channels, -1),
// cache.set('allPackets', packets, -1),
cache.set('allPackets', packets, -1),
]);

console.log(`Fetched packets and channels in ${Date.now() - start}ms`);
Expand Down
6 changes: 3 additions & 3 deletions app/api/packets/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function getPackets() {

let channel;
try {
console.log(`Getting channel for port ${portId} and channel ${srcChannelId}`);
console.log(`Getting channel for port ${portId} and channel ${srcChannelId} and sequence ${sequence}`);
channel = await tmClient.ibc.channel.channel(portId, srcChannelId);
} catch (e) {
console.log('Skipping packet for channel: ', srcChannelId);
Expand Down Expand Up @@ -201,7 +201,7 @@ export async function getPackets() {
}

const key = `${channel.channel.counterparty.portId}-${channel.channel.counterparty.channelId}-${sequence}`;
if (key in unprocessedPacketKeys) {
if (unprocessedPacketKeys.has(key)) {
packets[key].state = PacketStates.WRITE_ACK;
unprocessedPacketKeys.delete(key);
}
Expand Down Expand Up @@ -249,7 +249,7 @@ export async function getPackets() {
return;
}

if (key in unprocessedPacketKeys) {
if (unprocessedPacketKeys.has(key)) {
packets[key].state = PacketStates.RECV;
unprocessedPacketKeys.delete(key);
}
Expand Down

0 comments on commit ed43a12

Please sign in to comment.