Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
fix: tunel max rpm to 30
Browse files Browse the repository at this point in the history
  • Loading branch information
RetricSu committed Dec 3, 2021
1 parent 09d00d3 commit 38460b4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/api-server/src/methods/modules/poly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import { GodwokenClient } from "@godwoken-web3/godwoken";
import { parseGwRpcError } from "../gw-error";
import { AccessGuard } from "../../cache/guard";

const MAX_RPM = {
poly_executeRawL2Transaction: 30, // max: 0.5 req/s = 30 req/m
};

export class Poly {
private query: Query;
private rpc: GodwokenClient;
Expand All @@ -32,7 +36,10 @@ export class Poly {
this.rpc = new GodwokenClient(envConfig.godwokenJsonRpc);
this.accessGuard = new AccessGuard();
this.accessGuard.connect();
this.accessGuard.setMaxRpm("poly_executeRawL2Transaction", 60); // max: 1 req/s = 60 req/m
this.accessGuard.setMaxRpm(
"poly_executeRawL2Transaction",
MAX_RPM.poly_executeRawL2Transaction
);

this.getEthAddressByGodwokenShortAddress = middleware(
this.getEthAddressByGodwokenShortAddress.bind(this),
Expand Down

0 comments on commit 38460b4

Please sign in to comment.