mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-17 18:36:37 +00:00
Merge dev into fix/log-analytics-adjustments
This commit is contained in:
@@ -10,10 +10,7 @@ import { z } from "zod";
|
||||
import { fromError } from "zod-validation-error";
|
||||
import stoi from "@server/lib/stoi";
|
||||
import { sendToClient } from "#dynamic/routers/ws";
|
||||
import {
|
||||
fetchContainers,
|
||||
dockerSocket
|
||||
} from "../newt/dockerSocket";
|
||||
import { fetchContainers, dockerSocket } from "../newt/dockerSocket";
|
||||
import cache from "@server/lib/cache";
|
||||
|
||||
export interface ContainerNetwork {
|
||||
@@ -47,13 +44,13 @@ export interface Container {
|
||||
}
|
||||
|
||||
const siteIdParamsSchema = z.strictObject({
|
||||
siteId: z.string().transform(stoi).pipe(z.int().positive())
|
||||
});
|
||||
siteId: z.string().transform(stoi).pipe(z.int().positive())
|
||||
});
|
||||
|
||||
const DockerStatusSchema = z.strictObject({
|
||||
isAvailable: z.boolean(),
|
||||
socketPath: z.string().optional()
|
||||
});
|
||||
isAvailable: z.boolean(),
|
||||
socketPath: z.string().optional()
|
||||
});
|
||||
|
||||
function validateSiteIdParams(params: any) {
|
||||
const parsedParams = siteIdParamsSchema.safeParse(params);
|
||||
@@ -161,9 +158,7 @@ async function triggerFetch(siteId: number) {
|
||||
async function queryContainers(siteId: number) {
|
||||
const { newt } = await getSiteAndNewt(siteId);
|
||||
|
||||
const result = cache.get(
|
||||
`${newt.newtId}:dockerContainers`
|
||||
) as Container[];
|
||||
const result = cache.get(`${newt.newtId}:dockerContainers`) as Container[];
|
||||
if (!result) {
|
||||
throw createHttpError(
|
||||
HttpCode.TOO_EARLY,
|
||||
|
||||
Reference in New Issue
Block a user