refactor(drivers): decouple inproc cron from inproc worker and satisfy linter

This commit is contained in:
ryan
2026-08-28 15:17:11 +08:00
parent 0ff117da47
commit 06508b6f13
6 changed files with 60 additions and 20 deletions
@@ -16,6 +16,8 @@ import (
"Wavelet/pkg/util"
)
const defaultRetryBackoff = 500 * time.Millisecond
// TaskMessage represents an in-process task item in the queue.
type TaskMessage struct {
ID string
@@ -28,7 +30,6 @@ type TaskMessage struct {
// InprocQueue manages in-memory task queuing and worker pool execution.
type InprocQueue struct {
mu sync.RWMutex
concurrency int
queue chan TaskMessage
taskReg extpoints.TaskExtension
@@ -157,7 +158,7 @@ func (q *InprocQueue) executeTask(msg TaskMessage) {
msg.RetryLeft--
// Retry with backoff
util.Go(func() {
time.Sleep(500 * time.Millisecond)
time.Sleep(defaultRetryBackoff)
if q.running.Load() {
select {
case q.queue <- msg:
@@ -25,7 +25,7 @@ func (s *inprocTaskService) Dispatch(ctx context.Context, taskType string, paylo
return DispatchTask(ctx, taskType, payload, triggeredBy)
}
func (s *inprocTaskService) Retry(ctx context.Context, id uint64) (string, error) {
func (s *inprocTaskService) Retry(_ context.Context, id uint64) (string, error) {
return fmt.Sprintf("inproc_retry_%d", id), nil
}