load total reqs
All checks were successful
Publish Docker Images / docker (push) Successful in 1m21s

This commit is contained in:
Lee 2023-11-16 19:20:05 +00:00
parent f989feb78b
commit 35cdef1942

@ -66,7 +66,14 @@ async function logRequestToDatabase({
time,
cached,
}: InfluxLog) {
totalRequests = totalRequests ? totalRequests + 1 : 1;
if (!totalRequests) {
const metrics: any = await MetricsSchema.findOne({ _id: "proxy" }).exec();
if (metrics) {
totalRequests = metrics.totalRequests;
} else {
totalRequests = 0;
}
}
MetricsSchema.updateOne(
{ _id: "proxy" },
{ $set: { totalRequests: totalRequests } },