Skip to content

Commit

Permalink
remove rate limitg
Browse files Browse the repository at this point in the history
  • Loading branch information
jtgi committed Jul 13, 2024
1 parent 0a68363 commit fb36e95
Showing 1 changed file with 23 additions and 29 deletions.
52 changes: 23 additions & 29 deletions app/lib/validations.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { erc20Abi, erc721Abi, getAddress, getContract, parseUnits } from "viem";
import {
formatHash,
getSetCache,
getSharedEnv,
isWarpcastCastUrl,
validateErc1155,
validateErc20,
Expand All @@ -36,8 +35,7 @@ import { chainIdToChainName, nftsByWallets } from "./simplehash.server";
import { db } from "./db.server";
import { Cast, CastId } from "@neynar/nodejs-sdk/build/neynar-api/v2";
import axios from "axios";
import { UnrecoverableError } from "bullmq";
import { nodeRpcLimiter, openRankLimiter } from "./bullish.server";
import { openRankLimiter } from "./bullish.server";

export type RuleDefinition = {
name: RuleName;
Expand Down Expand Up @@ -2170,19 +2168,17 @@ async function openRankChannel(props: CheckFunctionArgs) {
key: `openrank:channel-rank:${channel.id}:${cast.author.fid}`,
ttlSeconds: 60 * 60 * 6,
get: () =>
openRankLimiter.schedule(() =>
axios
.post<GlobalRankResponse>(
`https://graph.cast.k3l.io/priority/channels/rankings/${channel.id}/fids`,
[cast.author.fid],
{
headers: {
"API-Key": process.env.OPENRANK_API_KEY,
},
}
)
.then((res) => res.data.result.find((u) => u.fid === cast.author.fid))
),
axios
.post<GlobalRankResponse>(
`https://graph.cast.k3l.io/priority/channels/rankings/${channel.id}/fids`,
[cast.author.fid],
{
headers: {
"API-Key": process.env.OPENRANK_API_KEY,
},
}
)
.then((res) => res.data.result.find((u) => u.fid === cast.author.fid)),
});

if (!user) {
Expand Down Expand Up @@ -2220,19 +2216,17 @@ async function openRankGlobalEngagement(props: CheckFunctionArgs) {
key: `openrank:global-rank:${cast.author.fid}`,
ttlSeconds: 60 * 60 * 6,
get: () =>
openRankLimiter.schedule(() =>
axios
.post<GlobalRankResponse>(
`https://graph.cast.k3l.io/priority/scores/global/engagement/fids`,
[cast.author.fid],
{
headers: {
"API-Key": process.env.OPENRANK_API_KEY,
},
}
)
.then((res) => res.data.result.find((u) => u.fid === cast.author.fid))
),
axios
.post<GlobalRankResponse>(
`https://graph.cast.k3l.io/priority/scores/global/engagement/fids`,
[cast.author.fid],
{
headers: {
"API-Key": process.env.OPENRANK_API_KEY,
},
}
)
.then((res) => res.data.result.find((u) => u.fid === cast.author.fid)),
});

if (!user) {
Expand Down

0 comments on commit fb36e95

Please sign in to comment.