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

No need to store pending metrics when jobs are exits #226

Open
whywaita opened this issue Jan 20, 2025 · 0 comments · May be fixed by #227
Open

No need to store pending metrics when jobs are exits #226

whywaita opened this issue Jan 20, 2025 · 0 comments · May be fixed by #227

Comments

@whywaita
Copy link
Owner

I follow the job exists in reRunWorkflow

func reRunWorkflowByPendingRun(ctx context.Context, ds datastore.Datastore, pendingRun datastore.PendingWorkflowRunWithTarget) error {
queuedJob, err := ds.ListJobs(ctx)
if err != nil {
return fmt.Errorf("failed to get list of jobs: %w", err)
}
for _, job := range queuedJob {
webhookEvent, err := github.ParseWebHook("workflow_job", []byte(job.CheckEventJSON))
if err != nil {
logger.Logf(false, "failed to parse webhook payload (job id: %s): %+v", job.UUID, err)
continue
}
workflowJob, ok := webhookEvent.(*github.WorkflowJobEvent)
if !ok {
logger.Logf(false, "failed to cast to WorkflowJobEvent (job id: %s)", job.UUID)
continue
}
if pendingRun.WorkflowRun.GetID() == workflowJob.GetWorkflowJob().GetRunID() {
logger.Logf(true, "found job in datastore, So will ignore: (repo: %s, runID: %d)", pendingRun.WorkflowRun.GetRepository().GetFullName(), pendingRun.WorkflowRun.GetID())
return nil
}
}
if err := enqueueRescueRun(ctx, pendingRun, ds); err != nil {
return fmt.Errorf("failed to enqueue rescue job: %w", err)
}
return nil
}

But I forget to follow job exits in scrape.

func GetPendingWorkflowRunByRecentRepositories(ctx context.Context, ds Datastore) ([]PendingWorkflowRunWithTarget, error) {

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 a pull request may close this issue.

1 participant