check for the last 2 hours instead of 1 to limit false positives
This commit is contained in:
parent
b1a4251be9
commit
0b99b46256
|
@ -4,8 +4,8 @@ import { sum } from "lodash";
|
||||||
import * as dateFns from "date-fns";
|
import * as dateFns from "date-fns";
|
||||||
import { clickhouseClient, knex } from "./databases";
|
import { clickhouseClient, knex } from "./databases";
|
||||||
|
|
||||||
const oneHourAgo = dateFns.format(
|
const twoHourAgo = dateFns.format(
|
||||||
dateFns.subHours(new Date(), 1),
|
dateFns.subHours(new Date(), 2),
|
||||||
"yyyy-MM-dd hh:mm:ss"
|
"yyyy-MM-dd hh:mm:ss"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ describe("Events", () => {
|
||||||
await clickhouseClient.query({
|
await clickhouseClient.query({
|
||||||
query: knex("events")
|
query: knex("events")
|
||||||
.count("")
|
.count("")
|
||||||
.where("created_at", ">", oneHourAgo)
|
.where("created_at", ">", twoHourAgo)
|
||||||
.toString(),
|
.toString(),
|
||||||
})
|
})
|
||||||
).json()) as any;
|
).json()) as any;
|
||||||
|
@ -26,7 +26,7 @@ describe("Events", () => {
|
||||||
await clickhouseClient.query({
|
await clickhouseClient.query({
|
||||||
query: knex("events")
|
query: knex("events")
|
||||||
.count()
|
.count()
|
||||||
.where("created_at", ">", oneHourAgo)
|
.where("created_at", ">", twoHourAgo)
|
||||||
.groupBy("geo_ip_country")
|
.groupBy("geo_ip_country")
|
||||||
.toString(),
|
.toString(),
|
||||||
format: "JSON",
|
format: "JSON",
|
||||||
|
|
Loading…
Reference in New Issue