Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbroks committed Nov 1, 2024
1 parent e212c9e commit 4ed209f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions apps/event-worker/src/job-dispatch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Worker } from "bullmq";
import { eq, takeFirstOrNull } from "@ctrlplane/db";
import { db } from "@ctrlplane/db/client";
import * as schema from "@ctrlplane/db/schema";
import { logger } from "@ctrlplane/logger";
import { Channel } from "@ctrlplane/validators/events";
import { JobAgentType, JobStatus } from "@ctrlplane/validators/jobs";

Expand All @@ -27,12 +26,15 @@ export const createDispatchExecutionJobWorker = () =>
.then(async (je) => {
if (je == null) return;

logger.info(`Dispatching job ${je.job.id}...`);

try {
if (je.job_agent.type === String(JobAgentType.GithubApp))
job.log(
`Dispatching job ${je.job.id} --- ${je.job_agent.type}/${je.job_agent.name}`,
);
if (je.job_agent.type === String(JobAgentType.GithubApp)) {
job.log(`Dispatching to GitHub app`);
await dispatchGithubJob(je.job);
} catch (error) {
}
} catch (error: unknown) {
db.update(schema.job)
.set({
status: JobStatus.Failure,
Expand Down

0 comments on commit 4ed209f

Please sign in to comment.