Skip to content

fix(experimental): Invalidate inflight cache in thirdweb rpcClient #823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
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();
});
}

24 changes: 24 additions & 0 deletions patches/thirdweb+5.78.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
Loading