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:
parent
664c719717
commit
f135338d74
2 changed files with 8 additions and 5 deletions
5
src/instrumentation.node.ts
Normal file
5
src/instrumentation.node.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { startTaskScheduler } from '@/lib/server/tasks/scheduler';
|
||||
|
||||
if (!process.env.VERCEL) {
|
||||
startTaskScheduler();
|
||||
}
|
||||
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue