Fake Capabilities - Refactor with context handling and job management#22012
Fake Capabilities - Refactor with context handling and job management#22012tarcisiozf wants to merge 8 commits intodevelopfrom
Conversation
|
👋 tarcisiozf, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
|
I see you updated files related to
|
|
✅ No conflicts with other open PRs targeting |
There was a problem hiding this comment.
Pull request overview
Risk Rating: MEDIUM (touches trigger execution behavior and introduces scheduler-based concurrency)
This PR refactors ManualCronTriggerService to use the gocron scheduler for per-trigger cron scheduling, aiming to improve manual trigger management, lifecycle cleanup, and error handling.
Changes:
- Added
gocrondependency and integrated a scheduler intoManualCronTriggerServicelifecycle (Start/Close). - Stored per-trigger cron configs and refactored
ManualTriggerto schedule viagocronand return a completion channel. - Added job creation / next-run error handling and job cleanup (remove job on completion).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
core/capabilities/fakes/manual_cron_trigger.go |
Integrates gocron, stores trigger configs, and refactors manual triggering to be scheduler-driven with job cleanup. |
go.mod |
Adds gocron/v2 requirement. |
go.sum |
Adds checksums for the new scheduler dependency. |
Scrupulous human review areas:
ManualTriggergoroutine + scheduler task coordination (channel signaling, cancellation, and avoiding deadlocks/panics):core/capabilities/fakes/manual_cron_trigger.go:125-182.- Service lifecycle correctness around scheduler start/shutdown and error propagation:
core/capabilities/fakes/manual_cron_trigger.go:205-217.
ed132a4 to
0d68ec6
Compare
|
|




DEVSVCS-4628
This pull request enhances the
ManualCronTriggerServiceby integrating thegocronscheduler, improving how manual cron triggers are managed and executed. The changes introduce per-trigger scheduling, better resource cleanup, and improved error handling. The service is now more robust and easier to test due to these improvements.Scheduler integration and trigger management:
gocronscheduler (github.com/go-co-op/gocron/v2) intoManualCronTriggerService, enabling cron-like scheduling for manual triggers. The scheduler is started and properly shut down with the service lifecycle.triggerConfigsmap to store cron configurations per trigger, allowing each trigger to have its own schedule.Manual trigger execution improvements:
ManualTriggerto use the scheduler for executing triggers, returning achan struct{}that signals completion, and added error handling for missing configs and job creation failures.