Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Queue stuff #5

Merged
merged 17 commits into from
Aug 30, 2024
Merged

fix: Queue stuff #5

merged 17 commits into from
Aug 30, 2024

Conversation

adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Aug 29, 2024

queue supremacy

Comment on lines 23 to 28
type SyncFunction = (je: JobExecution) => Promise<boolean | undefined>;

const getSyncFunction = (agentType: string): SyncFunction | null => {
if (agentType === JobAgentType.GithubApp) return syncGithubJobExecution;
return null;
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Comment on lines 51 to 56
function pRetry(
arg0: () => Promise<number | undefined>,
arg1: { retries: number; minTimeout: number },
) {
throw new Error("Function not implemented.");
}
Copy link
Member

@jsbroks jsbroks Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function pRetry(
arg0: () => Promise<number | undefined>,
arg1: { retries: number; minTimeout: number },
) {
throw new Error("Function not implemented.");
}

import it

Comment on lines 21 to 22
if (!parsed.success)
throw new Error(`Invalid job agent config for job execution ${je.id}`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of throwing errors set a message and set the status to 'invalid_provider', in the db table


export const configSchema = z.object({
installationId: z.number(),
login: z.string().min(1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
login: z.string().min(1),
owner: z.string().min(1),

Should this be in @ctrlplane/validators

message: (error as Error).message,
});
}
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need a .catch here as well to update status

owner: config.login,
repo: config.repo,
workflow_id: config.workflowId,
ref: "main",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ref: "main",
ref: config.ref,

maybe this configurable?

workflow_id: config.workflowId,
ref: "main",
inputs: {
job_execution_id: je.id.slice(0, 8),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we slice?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slicing to get the external run ID because its only the first 8 of the string

Comment on lines 13 to 17
Promise.all([
targetScanWorker.close(),
dispatchExecutionJobWorker.close(),
redis.quit(),
]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Promise.all makes no difference here if you not await

Comment on lines 7 to 8
AMQP_URL: z.string().optional(),
AMQP_QUEUE: z.string().default("job_configs"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AMQP_URL: z.string().optional(),
AMQP_QUEUE: z.string().default("job_configs"),

@adityachoudhari26 adityachoudhari26 merged commit 11f8875 into main Aug 30, 2024
10 checks passed
@adityachoudhari26 adityachoudhari26 deleted the queue-stuff branch August 30, 2024 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants