Init commit
This commit is contained in:
11
server/core/helpers/threads.ts
Normal file
11
server/core/helpers/threads.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user