Skip to content

Commit

Permalink
ci: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Oct 3, 2024
1 parent 6a4c06e commit 0d1f027
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions apps/server/src/v1/check/http/post.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ test("Create a single check ", async () => {
Promise.resolve(
new Response(
'{"status":200,"latency":100,"body":"Hello World","headers":{"Content-Type":"application/json"},"timestamp":1234567890,"timing":{"dnsStart":1,"dnsDone":2,"connectStart":3,"connectDone":4,"tlsHandshakeStart":5,"tlsHandshakeDone":6,"firstByteStart":7,"firstByteDone":8,"transferStart":9,"transferDone":10},"region":"ams"}',
{ status: 200, headers: { "content-type": "application/json" } }
)
)
{ status: 200, headers: { "content-type": "application/json" } },
),
),
);

const res = await api.request("/check", {
Expand Down Expand Up @@ -94,9 +94,9 @@ test.todo("Create a multiple check ", async () => {
Promise.resolve(
new Response(
'{"status":200,"latency":100,"body":"Hello World","headers":{"Content-Type":"application/json"},"timestamp":1234567890,"timing":{"dnsStart":1,"dnsDone":2,"connectStart":3,"connectDone":4,"tlsHandshakeStart":5,"tlsHandshakeDone":6,"firstByteStart":7,"firstByteDone":8,"transferStart":9,"transferDone":10},"region":"ams"}',
{ status: 200, headers: { "content-type": "application/json" } }
)
)
{ status: 200, headers: { "content-type": "application/json" } },
),
),
);

const res = await api.request("/check", {
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/v1/check/http/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ function getTiming(data: z.infer<typeof ResponseSchema>[]): ReturnGetTiming {
prev.dns.push(curr.timing.dnsDone - curr.timing.dnsStart);
prev.connect.push(curr.timing.connectDone - curr.timing.connectStart);
prev.tls.push(
curr.timing.tlsHandshakeDone - curr.timing.tlsHandshakeStart
curr.timing.tlsHandshakeDone - curr.timing.tlsHandshakeStart,
);
prev.firstByte.push(
curr.timing.firstByteDone - curr.timing.firstByteStart
curr.timing.firstByteDone - curr.timing.firstByteStart,
);
prev.transfer.push(curr.timing.transferDone - curr.timing.transferStart);
prev.latency.push(curr.latency);
Expand All @@ -173,7 +173,7 @@ function getTiming(data: z.infer<typeof ResponseSchema>[]): ReturnGetTiming {
firstByte: [],
transfer: [],
latency: [],
} as ReturnGetTiming
} as ReturnGetTiming,
);
}

Expand Down
14 changes: 7 additions & 7 deletions apps/web/src/app/api/checker/cron/_cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const cron = async ({
const parent = client.queuePath(
env.GCP_PROJECT_ID,
env.GCP_LOCATION,
periodicity
periodicity,
);

const timestamp = Date.now();
Expand All @@ -54,7 +54,7 @@ export const cron = async ({
.select({ id: maintenance.id })
.from(maintenance)
.where(
and(lte(maintenance.from, new Date()), gte(maintenance.to, new Date()))
and(lte(maintenance.from, new Date()), gte(maintenance.to, new Date())),
)
.as("currentMaintenance");

Expand All @@ -63,7 +63,7 @@ export const cron = async ({
.from(maintenancesToMonitors)
.innerJoin(
currentMaintenance,
eq(maintenancesToMonitors.maintenanceId, currentMaintenance.id)
eq(maintenancesToMonitors.maintenanceId, currentMaintenance.id),
);

const result = await db
Expand All @@ -73,8 +73,8 @@ export const cron = async ({
and(
eq(monitor.periodicity, periodicity),
eq(monitor.active, true),
notInArray(monitor.id, currentMaintenanceMonitors)
)
notInArray(monitor.id, currentMaintenanceMonitors),
),
)
.all();

Expand All @@ -98,7 +98,7 @@ export const cron = async ({
const monitorStatus = z.array(selectMonitorStatusSchema).safeParse(result);
if (!monitorStatus.success) {
console.error(
`Error while fetching the monitor status ${monitorStatus.error.errors}`
`Error while fetching the monitor status ${monitorStatus.error.errors}`,
);
continue;
}
Expand Down Expand Up @@ -137,7 +137,7 @@ export const cron = async ({
const failed = allRequests.filter((r) => r.status === "rejected").length;

console.log(
`End cron for ${periodicity} with ${allResult.length} jobs with ${success} success and ${failed} failed`
`End cron for ${periodicity} with ${allResult.length} jobs with ${success} success and ${failed} failed`,
);
};
// timestamp needs to be in ms
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/schema/monitors/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const headersToArraySchema = z.preprocess(
}
return [];
},
z.array(z.object({ key: z.string(), value: z.string() })).default([])
z.array(z.object({ key: z.string(), value: z.string() })).default([]),
);

export const selectMonitorSchema = createSelectSchema(monitor, {
Expand Down

0 comments on commit 0d1f027

Please sign in to comment.