feat(drivers): provide TaskService implementation in inproc worker

This commit is contained in:
ryan
2026-08-28 15:14:27 +08:00
parent f048dc528e
commit e434e6dc0a
2 changed files with 87 additions and 1 deletions
@@ -10,6 +10,7 @@ import (
"time"
"Wavelet/core"
"Wavelet/core/contracts"
)
const (
@@ -98,10 +99,13 @@ func (p *Plugin) Manifest() core.Manifest {
}
}
// Apply registers the worker driver into the Context.
// Apply registers the worker driver and provides contracts.TaskService.
func (p *Plugin) Apply(ctx *core.Context) error {
p.coreCtx = ctx
taskSvc := newInprocTaskService(ctx.Tasks())
core.Provide[contracts.TaskService](ctx, taskSvc)
ctx.OnDispose(func() error {
shutdownCtx, cancel := context.WithTimeout(context.Background(), p.shutdownTimeout)
defer cancel()