Cron

schedule code execution

the onSchedule function expects a time interval string, usually starting with every, and a callback to run.

v2

export const CRON_spawn_rares = onSchedule("every day 00:00", async () => {
  ...
})

v1

export const computeAndStoreRankingsCRON = functions.pubsub
    .schedule("every 8 hours")
    .onRun(async function (context) {
        const rankings = await computeRankings()
        await db.doc("rankings/rankings").set(rankings)
        return null
    })
earlymorning logo

© 2025 - All rights reserved

Cron

schedule code execution

the onSchedule function expects a time interval string, usually starting with every, and a callback to run.

v2

export const CRON_spawn_rares = onSchedule("every day 00:00", async () => {
  ...
})

v1

export const computeAndStoreRankingsCRON = functions.pubsub
    .schedule("every 8 hours")
    .onRun(async function (context) {
        const rankings = await computeRankings()
        await db.doc("rankings/rankings").set(rankings)
        return null
    })