Removed manual nice setting

This commit is contained in:
mrfry 2021-04-28 17:19:28 +02:00
parent 984fd8ce9e
commit c1197533c7
2 changed files with 12 additions and 12 deletions

View file

@ -27,9 +27,9 @@ 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' // import os from 'os'
os.setPriority(10) // os.setPriority(10)
console.log(`Process priority set to ${os.getPriority()}`) // console.log(`Process priority set to ${os.getPriority()}`)
import express from 'express' import express from 'express'
import vhost from 'vhost' import vhost from 'vhost'
@ -131,14 +131,14 @@ function exit(reason) {
const app = express() const app = express()
if (!process.env.NS_DEVEL) { if (!process.env.NS_DEVEL) {
app.use(function(req, res, next) { app.use(function (req, res, next) {
if (req.secure) { if (req.secure) {
next() next()
} else { } else {
logger.DebugLog( logger.DebugLog(
`HTTPS ${req.method} redirect to: ${'https://' + `HTTPS ${req.method} redirect to: ${
req.headers.host + 'https://' + req.headers.host + req.url
req.url}`, }`,
'https', 'https',
1 1
) )
@ -176,7 +176,7 @@ app.use(
}) })
) )
Object.keys(modules).forEach(function(key) { Object.keys(modules).forEach(function (key) {
const module = modules[key] const module = modules[key]
try { try {
const mod = require(module.path).default // eslint-disable-line const mod = require(module.path).default // eslint-disable-line
@ -261,7 +261,7 @@ function setLogTimer() {
return return
} }
setTimeout(function() { setTimeout(function () {
LogTimerAction() LogTimerAction()
rotateLog() rotateLog()
setLogTimer() setLogTimer()

View file

@ -1,4 +1,4 @@
import os from 'os' // 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'
@ -588,8 +588,8 @@ function doSearch(
// --------------------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------------------
if (!isMainThread) { if (!isMainThread) {
os.setPriority(10) // os.setPriority(10)
logger.Log(`Worker thread priority set to ${os.getPriority()}`) // 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