fix(drivers): propagate app-lifetime context through inproc cron/worker drivers

cron 触发与 worker 执行的任务现在继承应用生命周期 context(关闭时级联取消,带超时子上下文),
替代裸 context.Background()。contextcheck 清零。
lint_issues 26→24
This commit is contained in:
ryan
2026-08-28 17:04:44 +08:00
parent 02b93a3b20
commit 4d6be2fa77
6 changed files with 33 additions and 18 deletions
@@ -56,8 +56,9 @@ func (p *Plugin) Type() core.DriverType {
return core.DriverTypeScheduler
}
// Start boots the in-process cron scheduler.
func (p *Plugin) Start(_ context.Context) error {
// Start boots the in-process cron scheduler. ctx is the app-lifetime context;
// cron-dispatched tasks carry it so cancellation propagates on shutdown.
func (p *Plugin) Start(ctx context.Context) error {
p.mu.Lock()
defer p.mu.Unlock()
@@ -66,7 +67,7 @@ func (p *Plugin) Start(_ context.Context) error {
p.scheduler = newInprocScheduler(p.coreCtx.Schedules(), p.coreCtx.Tasks(), taskSvc)
}
return p.scheduler.Start()
return p.scheduler.Start(ctx)
}
// Stop terminates the in-process cron scheduler.