mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
New forum content.json init changed to {}, process priority auto set to 10
This commit is contained in:
parent
7571ffe271
commit
8d3c0d7592
3 changed files with 10 additions and 1 deletions
|
@ -94,7 +94,7 @@ function getForumData(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!utils.FileExists(contentFilePath)) {
|
if (!utils.FileExists(contentFilePath)) {
|
||||||
utils.WriteFile('[]', contentFilePath)
|
utils.WriteFile('{}', contentFilePath)
|
||||||
}
|
}
|
||||||
const contents = utils.ReadJSON(contentFilePath)
|
const contents = utils.ReadJSON(contentFilePath)
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -27,6 +27,10 @@ const isRoot = process.getuid && process.getuid() === 0
|
||||||
const port = isRoot ? 80 : 8080
|
const port = isRoot ? 80 : 8080
|
||||||
const httpsport = isRoot ? 443 : 5001
|
const httpsport = isRoot ? 443 : 5001
|
||||||
|
|
||||||
|
import os from 'os'
|
||||||
|
os.setPriority(10)
|
||||||
|
console.log(`Process priority set to ${os.getPriority()}`)
|
||||||
|
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import vhost from 'vhost'
|
import vhost from 'vhost'
|
||||||
import http from 'http'
|
import http from 'http'
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import os from 'os'
|
||||||
import { isMainThread, parentPort, workerData } from 'worker_threads'
|
import { isMainThread, parentPort, workerData } from 'worker_threads'
|
||||||
|
|
||||||
import logger from './logger'
|
import logger from './logger'
|
||||||
import {
|
import {
|
||||||
Question,
|
Question,
|
||||||
|
@ -586,6 +588,9 @@ function doSearch(
|
||||||
// ---------------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
if (!isMainThread) {
|
if (!isMainThread) {
|
||||||
|
os.setPriority(10)
|
||||||
|
logger.Log(`Worker thread priority set to ${os.getPriority()}`)
|
||||||
|
|
||||||
const { workerIndex } = workerData
|
const { workerIndex } = workerData
|
||||||
let qdbs: Array<QuestionDb> = workerData.initData
|
let qdbs: Array<QuestionDb> = workerData.initData
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue