mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added licence notice to many files, other minor type fixes
This commit is contained in:
parent
d9175c1fc2
commit
75d93af246
22 changed files with 483 additions and 107 deletions
|
@ -1,4 +1,23 @@
|
|||
// import os from 'os'
|
||||
/* ----------------------------------------------------------------------------
|
||||
|
||||
Question Server
|
||||
GitLab: <https://gitlab.com/MrFry/mrfrys-node-server>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
import { isMainThread, parentPort, workerData } from 'worker_threads'
|
||||
|
||||
import logger from './logger'
|
||||
|
@ -13,7 +32,7 @@ import { editDb, Edits } from './actions'
|
|||
export interface WorkerResult {
|
||||
msg: string
|
||||
workerIndex: number
|
||||
result: SearchResultQuestion[]
|
||||
result?: SearchResultQuestion[]
|
||||
}
|
||||
|
||||
interface DetailedMatch {
|
||||
|
@ -557,7 +576,7 @@ function doSearch(
|
|||
function setNoPossibleAnswersPenalties(
|
||||
possibleAnswers: QuestionData['possibleAnswers'],
|
||||
result: SearchResultQuestion[]
|
||||
): any {
|
||||
): SearchResultQuestion[] {
|
||||
if (!Array.isArray(possibleAnswers)) {
|
||||
return result
|
||||
}
|
||||
|
@ -605,9 +624,6 @@ interface WorkData {
|
|||
}
|
||||
|
||||
if (!isMainThread) {
|
||||
// os.setPriority(10)
|
||||
// logger.Log(`Worker thread priority set to ${os.getPriority()}`)
|
||||
|
||||
const {
|
||||
workerIndex,
|
||||
initData,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue