Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

some improvements

Blue Mousea8d1f03caf4f
diff --git a/src/alert/entity/alert.entity.ts b/src/alert/entity/alert.entity.ts
index f690f9266..671740684 100644
--- a/src/alert/entity/alert.entity.ts
+++ b/src/alert/entity/alert.entity.ts
@@ -49,7 +49,7 @@ export class Alert {
nullable: true,
default: null,
})
- queryMetric: QueryMetric | null
+ queryMetric: QueryMetric
@ApiProperty()
@Column({
@@ -58,7 +58,7 @@ export class Alert {
nullable: true,
default: null,
})
- queryCondition: QueryCondition | null
+ queryCondition: QueryCondition
@ApiProperty()
@Column({
@@ -66,7 +66,7 @@ export class Alert {
nullable: true,
default: null,
})
- queryValue: number | null
+ queryValue: number
@ApiProperty()
@Column({
@@ -75,5 +75,5 @@ export class Alert {
nullable: true,
default: null,
})
- queryTime: QueryTime | null
+ queryTime: QueryTime
}
diff --git a/src/task-manager/task-manager.service.ts b/src/task-manager/task-manager.service.ts
index 4ac7173c1..24ec3c03d 100644
--- a/src/task-manager/task-manager.service.ts
+++ b/src/task-manager/task-manager.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@nestjs/common'
import { Cron, CronExpression } from '@nestjs/schedule'
-import { IsNull, LessThan, Not, In } from 'typeorm'
+import { IsNull, LessThan, In, Not } from 'typeorm'
import * as bcrypt from 'bcrypt'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
@@ -390,6 +390,7 @@ export class TaskManagerService {
const alerts = await this.alertService.findWhere({
project: In(_map(projects, 'id')),
active: true,
+ queryMetric: QueryMetric.ONLINE_USERS,
})
for (let i = 0; i < _size(alerts); ++i) {
@@ -441,6 +442,7 @@ export class TaskManagerService {
const alerts = await this.alertService.findWhere({
project: In(_map(projects, 'id')),
active: true,
+ queryMetric: Not(QueryMetric.ONLINE_USERS),
})
for (let i = 0; i < _size(alerts); ++i) {