Skip to content

Support more options with context#27

Merged
wolfogre merged 5 commits into
masterfrom
feature/cron_option
May 12, 2026
Merged

Support more options with context#27
wolfogre merged 5 commits into
masterfrom
feature/cron_option

Conversation

@wolfogre
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 12, 2026 07:12
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (11a2718) to head (bde3e8e).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          297       320   +23     
=========================================
+ Hits           297       320   +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new job option to derive a per-run (per-attempt) context.Context from the job’s base context and current Task, enabling more flexible context scoping around Run executions.

Changes:

  • Introduced DeriveContext and WithDeriveContext to let callers customize the context used by Run.
  • Stored the new option on innerJob and applied it inside the retry loop before calling safeRun.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
job_option.go Adds DeriveContext type + WithDeriveContext option to configure per-run context derivation.
inner_job.go Threads the derived context into safeRun for each retry attempt.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread job_option.go Outdated
Comment thread inner_job.go Outdated
Comment thread job_option.go Outdated
Comment thread inner_job.go Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

Comment thread inner_job.go
Comment thread inner_job.go
Comment thread job_option.go
Comment thread job_option.go Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/M labels May 12, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread inner_job.go
Comment on lines 78 to +82
ctx, cancel := context.WithDeadline(context.WithValue(parentCtx, keyContextTask, task), nextAt)
defer cancel()

if j.before != nil && j.before(task) {
task.Skipped = true
atomic.AddInt64(&j.statistics.SkippedTask, 1)
if j.deriveContext != nil {
ctx = j.deriveContext(ctx, task)
@wolfogre wolfogre merged commit c368a43 into master May 12, 2026
7 checks passed
@wolfogre wolfogre deleted the feature/cron_option branch May 12, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants