Skip to content

Commit

Permalink
🐛 save some bandwith and memory
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay committed Dec 18, 2024
1 parent 50b980f commit 2e904c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions apps/checker/handlers/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ func (h Handler) HTTPCheckerHandler(c *gin.Context) {

returnData := c.Query("data")
if returnData == "true" {

if len(result.Body) > 1024 {
result.Body = result.Body[:1000]
}

c.JSON(http.StatusOK, result)

return
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/v1/monitors/trigger/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export function registerTriggerMonitor(api: typeof monitorsApi) {
.where(
and(
eq(monitorRun.workspaceId, Number(workspaceId)),
gte(monitorRun.createdAt, new Date(lastMonth)),
),
gte(monitorRun.createdAt, new Date(lastMonth))
)
)
.all()
)[0].count;
Expand All @@ -73,8 +73,8 @@ export function registerTriggerMonitor(api: typeof monitorsApi) {
and(
eq(monitor.id, Number(id)),
eq(monitor.workspaceId, Number(workspaceId)),
isNull(monitor.deletedAt),
),
isNull(monitor.deletedAt)
)
)
.get();

Expand Down Expand Up @@ -186,9 +186,9 @@ export function registerTriggerMonitor(api: typeof monitorsApi) {
function generateUrl({ row }: { row: z.infer<typeof selectMonitorSchema> }) {
switch (row.jobType) {
case "http":
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=true`;
return `https://openstatus-checker.fly.dev/checker/http?monitor_id=${row.id}&trigger=api&data=false`;
case "tcp":
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=true`;
return `https://openstatus-checker.fly.dev/checker/tcp?monitor_id=${row.id}&trigger=api&data=false`;
default:
throw new Error("Invalid jobType");
}
Expand Down

0 comments on commit 2e904c2

Please sign in to comment.