Skip to content
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

cron: change to GET #119

Merged
merged 1 commit into from
Sep 7, 2024
Merged
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
7 changes: 4 additions & 3 deletions app/api/stats/set-historical-volume-kv/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
HISTORICAL_VOLUME_SET_KEY,
} from "@/app/api/stats/constants"

export const maxDuration = 300

interface VolumeData {
timestamp: number
volume: number
Expand All @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions app/api/stats/set-inflow-kv/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map<bigint, bigint>> {
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion app/api/stats/set-net-flow-kv/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading