chore(instrumentation): delegate node-specific setup to separate module

Move Node.js-specific instrumentation logic to a dedicated file. Update
registration to dynamically import the node module only when running in a
Node.js environment. This separation clarifies environment-specific behavior
and improves maintainability.
This commit is contained in:
Richard R 2026-06-07 06:09:14 -06:00
parent 664c719717
commit f135338d74
2 changed files with 8 additions and 5 deletions

View file

@ -0,0 +1,5 @@
import { startTaskScheduler } from '@/lib/server/tasks/scheduler';
if (!process.env.VERCEL) {
startTaskScheduler();
}

View file

@ -4,9 +4,7 @@
* nothing to keep a loop alive, so a cron route drives the ticks instead.
*/
export async function register(): Promise<void> {
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');
}
}