forgot to update total reqs
All checks were successful
Publish Docker Images / docker (push) Successful in 1m21s
All checks were successful
Publish Docker Images / docker (push) Successful in 1m21s
This commit is contained in:
parent
35cdef1942
commit
cb03d5aa42
@ -11,7 +11,7 @@ const IGNORED_PATHS = ["/favicon.ico"];
|
|||||||
* The total requests that have been made
|
* The total requests that have been made
|
||||||
* TODO: move this to a metrics file
|
* TODO: move this to a metrics file
|
||||||
*/
|
*/
|
||||||
let totalRequests: number | undefined;
|
let totalRequests: number | undefined = undefined;
|
||||||
|
|
||||||
const cache = new Cache({
|
const cache = new Cache({
|
||||||
stdTTL: 300, // 5 minutes
|
stdTTL: 300, // 5 minutes
|
||||||
@ -66,14 +66,15 @@ async function logRequestToDatabase({
|
|||||||
time,
|
time,
|
||||||
cached,
|
cached,
|
||||||
}: InfluxLog) {
|
}: InfluxLog) {
|
||||||
if (!totalRequests) {
|
if (totalRequests === undefined) {
|
||||||
const metrics: any = await MetricsSchema.findOne({ _id: "proxy" }).exec();
|
const metrics: any = await MetricsSchema.findOne({ _id: "proxy" }).exec();
|
||||||
if (metrics) {
|
if (metrics) {
|
||||||
totalRequests = metrics.totalRequests;
|
totalRequests = metrics.totalRequests as number;
|
||||||
} else {
|
} else {
|
||||||
totalRequests = 0;
|
totalRequests = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
totalRequests++;
|
||||||
MetricsSchema.updateOne(
|
MetricsSchema.updateOne(
|
||||||
{ _id: "proxy" },
|
{ _id: "proxy" },
|
||||||
{ $set: { totalRequests: totalRequests } },
|
{ $set: { totalRequests: totalRequests } },
|
||||||
|
Loading…
Reference in New Issue
Block a user