diff --git a/src/instrumentation.node.ts b/src/instrumentation.node.ts new file mode 100644 index 0000000..b4b076c --- /dev/null +++ b/src/instrumentation.node.ts @@ -0,0 +1,5 @@ +import { startTaskScheduler } from '@/lib/server/tasks/scheduler'; + +if (!process.env.VERCEL) { + startTaskScheduler(); +} diff --git a/src/instrumentation.ts b/src/instrumentation.ts index 9095fae..43739b6 100644 --- a/src/instrumentation.ts +++ b/src/instrumentation.ts @@ -4,9 +4,7 @@ * nothing to keep a loop alive, so a cron route drives the ticks instead. */ export async function register(): Promise { - if (process.env.VERCEL) return; - if (process.env.NEXT_RUNTIME !== 'nodejs') return; - - const { startTaskScheduler } = await import('@/lib/server/tasks/scheduler'); - startTaskScheduler(); + if (process.env.NEXT_RUNTIME === 'nodejs') { + await import('./instrumentation.node'); + } }