add sentry
All checks were successful
deploy / deploy (push) Successful in 33s

This commit is contained in:
Lee
2023-10-31 14:22:06 +00:00
parent e0363de4ad
commit 4c6a8c80fb
7 changed files with 293 additions and 100 deletions

View File

@ -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);