1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-03 17:59:37 +02:00
Peertube/server/core/helpers/threads.ts
2025-05-13 16:06:37 +02:00

11 lines
357 B
TypeScript

import { isTestOrDevInstance } from '@peertube/peertube-node-utils'
import { isMainThread } from 'node:worker_threads'
import { logger } from './logger.js'
export function assertIsInWorkerThread () {
if (!isMainThread) return
logger.error('Caller is not in worker thread', { stack: new Error().stack })
if (isTestOrDevInstance()) process.exit(1)
}