I forgor.
This commit is contained in:
parent
e760e6bd38
commit
007433844b
|
@ -38,6 +38,7 @@ export default async function postTasks() {
|
||||||
log("Done!")
|
log("Done!")
|
||||||
|
|
||||||
log("Processing points for players...")
|
log("Processing points for players...")
|
||||||
|
const totalPlayers = await Player.find({}).count()
|
||||||
let processedPlayerPoints = 0
|
let processedPlayerPoints = 0
|
||||||
for (const entry of cache.pointsRanks) {
|
for (const entry of cache.pointsRanks) {
|
||||||
spread(
|
spread(
|
||||||
|
@ -49,7 +50,7 @@ export default async function postTasks() {
|
||||||
).then(
|
).then(
|
||||||
() => {
|
() => {
|
||||||
++processedPlayerPoints
|
++processedPlayerPoints
|
||||||
log(`Processed player ${processedPlayerPoints}/${cache.pointsRanks.length} -> «${entry[0]}» has ${entry[1]} points!`)
|
log(`Processed player ${processedPlayerPoints}/${totalPlayers} -> «${entry[0]}» has ${entry[1]} points!`)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -61,7 +62,7 @@ export default async function postTasks() {
|
||||||
'./playerRankPoints.js',
|
'./playerRankPoints.js',
|
||||||
{
|
{
|
||||||
name: entry[0],
|
name: entry[0],
|
||||||
rankPoints: [1]
|
rankPoints: entry[1]
|
||||||
}
|
}
|
||||||
).then(
|
).then(
|
||||||
() => {
|
() => {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export function initWorkers(threads) {
|
||||||
|
|
||||||
setInterval(
|
setInterval(
|
||||||
scheduler,
|
scheduler,
|
||||||
50
|
process.env.SCHEDULE_TIME ?? 50
|
||||||
)
|
)
|
||||||
|
|
||||||
log(`Initialised the scheduler!`)
|
log(`Initialised the scheduler!`)
|
||||||
|
|
|
@ -10,6 +10,8 @@ const Player = new mongoose.Schema({
|
||||||
firstFinish: Date
|
firstFinish: Date
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Player.index({ name: 1 })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This cotains the mongoose 'Player' model.
|
* This cotains the mongoose 'Player' model.
|
||||||
* @module schemas/Player
|
* @module schemas/Player
|
||||||
|
|
Loading…
Reference in New Issue
Block a user