Skip to content

Commit

Permalink
fix(experimental): Invalidate inflight cache in thirdweb rpcClient
Browse files Browse the repository at this point in the history
  • Loading branch information
arcoraven committed Jan 1, 2025
1 parent b2a0b1a commit 303ff37
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 7 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"test:unit": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "yarn biome lint",
"copy-files": "cp -r ./src/prisma ./dist/"
"copy-files": "cp -r ./src/prisma ./dist/",
"postinstall": "patch-package"
},
"dependencies": {
"@aws-sdk/client-kms": "^3.679.0",
Expand Down Expand Up @@ -63,7 +64,9 @@
"knex": "^3.1.0",
"mnemonist": "^0.39.8",
"node-cron": "^3.0.2",
"patch-package": "^8.0.0",
"pg": "^8.11.3",
"postinstall-postinstall": "^2.1.0",
"prisma": "^5.14.0",
"prom-client": "^15.1.3",
"superjson": "^2.2.1",
Expand Down
24 changes: 24 additions & 0 deletions patches/thirdweb+5.71.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/node_modules/thirdweb/src/rpc/rpc.ts b/node_modules/thirdweb/src/rpc/rpc.ts
index a17705ba..f5ea53f6 100644
--- a/node_modules/thirdweb/src/rpc/rpc.ts
+++ b/node_modules/thirdweb/src/rpc/rpc.ts
@@ -167,17 +167,15 @@ export function getRpcClient(
} else {
inflight.resolve(response.result);
}
- // remove the inflight request from the inflightRequests map
- inflightRequests.delete(inflight.requestKey);
});
})
.catch((err) => {
// http call failed, reject all inflight requests
for (const inflight of activeBatch) {
inflight.reject(err);
- // remove the inflight request from the inflightRequests map
- inflightRequests.delete(inflight.requestKey);
}
+ }).finally(() => {
+ inflightRequests.clear();
});
}

Loading

0 comments on commit 303ff37

Please sign in to comment.