diff --git a/app/api/stats/set-historical-volume-kv/route.ts b/app/api/stats/set-historical-volume-kv/route.ts index 47569048..95b3ffc4 100644 --- a/app/api/stats/set-historical-volume-kv/route.ts +++ b/app/api/stats/set-historical-volume-kv/route.ts @@ -8,8 +8,6 @@ import { HISTORICAL_VOLUME_SET_KEY, } from "@/app/api/stats/constants" -export const maxDuration = 300 - interface VolumeData { timestamp: number volume: number @@ -27,7 +25,10 @@ const DEFAULT_PARAMS: SearchParams = { interval: 24 * 60 * 60, } -export async function POST(req: NextRequest) { +export const maxDuration = 300 +export const dynamic = "force-dynamic" + +export async function GET(req: NextRequest) { console.log("Starting cron job: set-volume-kv") try { const ddog = new DDogClient() diff --git a/app/api/stats/set-inflow-kv/route.ts b/app/api/stats/set-inflow-kv/route.ts index d1470148..e9d00bd0 100644 --- a/app/api/stats/set-inflow-kv/route.ts +++ b/app/api/stats/set-inflow-kv/route.ts @@ -23,14 +23,14 @@ import { amountTimesPrice } from "@/hooks/use-usd-price" import { DISPLAY_TOKENS, remapToken } from "@/lib/token" import { chain } from "@/lib/viem" -export const maxDuration = 300 -export const dynamic = "force-dynamic" - const viemClient = createPublicClient({ chain, transport: http(process.env.RPC_URL), }) +export const maxDuration = 300 +export const dynamic = "force-dynamic" + async function getBlockTimestamps( blockNumbers: bigint[], ): Promise> { @@ -48,7 +48,7 @@ async function getBlockTimestamps( return blockNumberToTimestamp } -export async function POST(req: NextRequest) { +export async function GET(req: NextRequest) { console.log("Starting POST request: set-inflow-kv") try { // Get all token prices diff --git a/app/api/stats/set-net-flow-kv/route.ts b/app/api/stats/set-net-flow-kv/route.ts index bfbd6282..bbff58a8 100644 --- a/app/api/stats/set-net-flow-kv/route.ts +++ b/app/api/stats/set-net-flow-kv/route.ts @@ -10,7 +10,10 @@ import { getAllSetMembers } from "@/app/lib/kv-utils" const TWENTY_FOUR_HOURS = 24 * 60 * 60 * 1000 // 24 hours in milliseconds -export async function POST() { +export const maxDuration = 300 +export const dynamic = "force-dynamic" + +export async function GET() { console.log("Starting net flow calculation cron job") try { const now = Date.now()