This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import { Point } from "@influxdata/influxdb-client";
|
||||
import axios from "axios";
|
||||
import cron from "node-cron";
|
||||
import { w3cwebsocket as WebsocketClient } from "websocket";
|
||||
import { InfluxWriteAPI } from "..";
|
||||
import { connectMongo } from "../db/mongo";
|
||||
@ -18,6 +19,7 @@ async function update() {
|
||||
.intField("value", parseInt(count))
|
||||
.timestamp(new Date());
|
||||
InfluxWriteAPI.writePoint(point);
|
||||
console.log(`Updated player count to ${count}`);
|
||||
|
||||
if (totalScores) {
|
||||
InfluxWriteAPI.writePoint(
|
||||
@ -26,9 +28,8 @@ async function update() {
|
||||
.intField("value", totalScores)
|
||||
.timestamp(new Date())
|
||||
);
|
||||
console.log(`Updated score count to ${totalScores}`);
|
||||
}
|
||||
|
||||
console.log(`Updated player count to ${count}`);
|
||||
}
|
||||
|
||||
async function connectWebsocket() {
|
||||
@ -83,7 +84,7 @@ async function connectWebsocket() {
|
||||
leaderboardPlayerInfo: player,
|
||||
pp,
|
||||
} = score;
|
||||
const { maxScore, stars, id: leaderboardId } = leaderboard;
|
||||
const { maxScore, stars } = leaderboard;
|
||||
|
||||
const hmdName = Headsets[hmd] || "Unknown";
|
||||
const countryId = normalizedRegionName(player.country) || "Unknown";
|
||||
@ -144,4 +145,4 @@ async function connectWebsocket() {
|
||||
|
||||
update();
|
||||
connectWebsocket();
|
||||
setInterval(update, 60_000); // 1 minute
|
||||
cron.schedule("*/5 * * * *", update);
|
||||
|
Reference in New Issue
Block a user