mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Modified stuff for easyer testing, logging questiondb count in daily stats
This commit is contained in:
parent
d7b5ad8160
commit
cc19b5424b
8 changed files with 11 additions and 40 deletions
|
@ -1 +0,0 @@
|
|||
[]
|
|
@ -13,6 +13,9 @@ export const testUser = {
|
|||
avaiblePWRequests: 645,
|
||||
pwRequestCount: 19,
|
||||
created: new Date(),
|
||||
pw: 'secret',
|
||||
loginCount: 3,
|
||||
createdBy: 1,
|
||||
}
|
||||
|
||||
function renderLogin(req, res, jsonResponse) {
|
||||
|
|
|
@ -66,6 +66,7 @@ function ExportDailyDataCount(questionDbs, userDB) {
|
|||
date: utils.GetDateString(),
|
||||
subjectCount: getSubjCount(questionDbs),
|
||||
questionCount: getQuestionCount(questionDbs),
|
||||
questionDbsCount: questionDbs.length,
|
||||
userCount: dbtools.TableInfo(userDB, 'users').dataCount,
|
||||
}),
|
||||
dailyDataCountFile
|
||||
|
|
|
@ -48,7 +48,6 @@ export interface RecievedData {
|
|||
subj: string
|
||||
id: string
|
||||
version: string
|
||||
scriptVersion: string
|
||||
location: string
|
||||
}
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import { compareString } from './classes'
|
||||
|
||||
const testCases: Array<{ s1: string; s2: string; res: number }> = [
|
||||
{ s1: 'hello', s2: 'hello', res: 100 },
|
||||
{ s1: 'aaaaa', s2: 'bbbbb', res: 0 },
|
||||
{
|
||||
s1: 'Mely állítás nem igaz a tőzsdékre?',
|
||||
s2: 'Mely állítás nem igaz a tőzsdékre?',
|
||||
res: 100,
|
||||
},
|
||||
{
|
||||
s1: 'Mely állítás nem igaz a tőzsdékre?',
|
||||
s2: 'Ez egy teljesen más mondat',
|
||||
res: 0,
|
||||
},
|
||||
{ s1: 'cHar caSe tESt', s2: 'ChaR cAse TEst', res: 0 },
|
||||
]
|
||||
|
||||
testCases.forEach((currCase) => {
|
||||
const { s1, s2, res } = currCase
|
||||
|
||||
test(`String compare tests: "${s1}" & "${s2}" should be: ${res}%`, () => {
|
||||
expect(compareString(s1, s1.split(' '), s2, s2.split(' '))).toBe(res)
|
||||
})
|
||||
})
|
|
@ -87,20 +87,12 @@ export function doALongTask(
|
|||
})
|
||||
}
|
||||
|
||||
export function initWorkerPool(initData: any): void {
|
||||
export function initWorkerPool(initData: any): Array<WorkerObj> {
|
||||
if (workers) {
|
||||
logger.Log('WORKERS ALREADY EXISTS', logger.GetColor('redbg'))
|
||||
return
|
||||
}
|
||||
workers = []
|
||||
const factory = {
|
||||
create: function(index) {
|
||||
return getAWorker(index, initData)
|
||||
},
|
||||
destroy: function(client) {
|
||||
client.worker.terminate()
|
||||
},
|
||||
}
|
||||
|
||||
const threadCount = process.env.NS_THREAD_COUNT || os.cpus().length
|
||||
if (process.env.NS_THREAD_COUNT) {
|
||||
|
@ -112,11 +104,13 @@ export function initWorkerPool(initData: any): void {
|
|||
|
||||
for (let i = 0; i < threadCount; i++) {
|
||||
workers.push({
|
||||
worker: factory.create(i),
|
||||
worker: getAWorker(i, initData),
|
||||
index: i,
|
||||
free: true,
|
||||
})
|
||||
}
|
||||
|
||||
return workers
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d06e9900445ca8af4ee354244b056f24bb76bc0c
|
||||
Subproject commit 27211c7bc83e0e930fabc430ffb5615b52523106
|
|
@ -1 +1 @@
|
|||
Subproject commit ae9a168ada577d65a71ac27ef3959624ed3e71da
|
||||
Subproject commit 11e7c5c5679457e999a95bd24b80108f6d7811ab
|
Loading…
Add table
Add a link
Reference in a new issue