Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/event-worker/src/workers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import type { Worker } from "bullmq";
import { Channel } from "@ctrlplane/events";

import { dispatchJobWorker } from "./job-dispatch/index.js";
import { newDeploymentWorker } from "./new-deployment.js";
import { resourceScanWorker } from "./resource-scan/index.js";

type Workers<T extends keyof ChannelMap> = {
[K in T]: Worker<ChannelMap[K]> | null;
};

export const workers: Workers<keyof ChannelMap> = {
[Channel.NewDeployment]: null,
[Channel.NewDeployment]: newDeploymentWorker,
[Channel.NewEnvironment]: null,
[Channel.ReleaseEvaluate]: null,
[Channel.DispatchJob]: dispatchJobWorker,
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/router/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
takeFirstOrNull,
} from "@ctrlplane/db";
import * as SCHEMA from "@ctrlplane/db/schema";
import { Channel, getQueue } from "@ctrlplane/events";
import {
getEventsForDeploymentRemoved,
handleEvent,
Expand Down Expand Up @@ -120,6 +121,9 @@ const hookRouter = createTRPCRouter({
.values({ hookId: h.id, runbookId: rb.id })
.returning()
.then(takeFirst);

await getQueue(Channel.NewDeployment).add(dep.id, dep);

return { ...h, runhook: rh };
}),
),
Expand Down
3 changes: 1 addition & 2 deletions packages/events/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export type ReleaseEvaluateJobData = {
};

export type ChannelMap = {
// [Channel.UpsertRelease]: typeof schema.release.$inferInsert;
[Channel.NewDeployment]: typeof schema.deployment.$inferSelect;
[Channel.NewDeployment]: schema.Deployment;
[Channel.NewEnvironment]: typeof schema.environment.$inferSelect;
[Channel.ReleaseEvaluate]: ReleaseEvaluateJobData;
[Channel.DispatchJob]: { jobId: string };
Expand Down
Loading