refactor(multi-server): add flag to queues

This commit is contained in:
Mauricio Siu
2024-09-21 21:57:53 -06:00
parent 069f1a7b7a
commit 82588f3e16
5 changed files with 5 additions and 2 deletions

View File

@@ -19,10 +19,8 @@ import {
} from "@/components/ui/form"; } from "@/components/ui/form";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { api } from "@/utils/api"; import { api } from "@/utils/api";
import { useUrl } from "@/utils/hooks/use-url";
import { zodResolver } from "@hookform/resolvers/zod"; import { zodResolver } from "@hookform/resolvers/zod";
import { Edit } from "lucide-react"; import { Edit } from "lucide-react";
import { useRouter } from "next/router";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
import { toast } from "sonner"; import { toast } from "sonner";

View File

@@ -87,6 +87,7 @@ export default async function handler(
descriptionLog: `Hash: ${deploymentHash}`, descriptionLog: `Hash: ${deploymentHash}`,
type: "deploy", type: "deploy",
applicationType: "application", applicationType: "application",
server: !!application.serverId,
}; };
await myQueue.add( await myQueue.add(
"deployments", "deployments",

View File

@@ -63,6 +63,7 @@ export default async function handler(
type: "deploy", type: "deploy",
applicationType: "compose", applicationType: "compose",
descriptionLog: `Hash: ${deploymentHash}`, descriptionLog: `Hash: ${deploymentHash}`,
server: !!composeResult.serverId,
}; };
await myQueue.add( await myQueue.add(
"deployments", "deployments",

View File

@@ -86,6 +86,7 @@ export default async function handler(
descriptionLog: `Hash: ${deploymentHash}`, descriptionLog: `Hash: ${deploymentHash}`,
type: "deploy", type: "deploy",
applicationType: "application", applicationType: "application",
server: !!app.serverId,
}; };
await myQueue.add( await myQueue.add(
"deployments", "deployments",

View File

@@ -187,12 +187,14 @@ export const composeRouter = createTRPCRouter({
redeploy: protectedProcedure redeploy: protectedProcedure
.input(apiFindCompose) .input(apiFindCompose)
.mutation(async ({ input }) => { .mutation(async ({ input }) => {
const compose = await findComposeById(input.composeId);
const jobData: DeploymentJob = { const jobData: DeploymentJob = {
composeId: input.composeId, composeId: input.composeId,
titleLog: "Rebuild deployment", titleLog: "Rebuild deployment",
type: "redeploy", type: "redeploy",
applicationType: "compose", applicationType: "compose",
descriptionLog: "", descriptionLog: "",
server: !!compose.serverId,
}; };
await myQueue.add( await myQueue.add(
"deployments", "deployments",