mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-03 23:06:36 +08:00
fix(tasks): canonicalize triggered_by so execution labels resolve
Unknown values such as http and inproc_cron made the admin UI call t(undefined). Dispatch sites now write system/manual/retry/schedule, the list API maps legacy rows, and the table skips missing i18n keys.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package driver_asynq_worker
|
||||
|
||||
import (
|
||||
"Wavelet/core/contracts"
|
||||
"Wavelet/pkg/idgen"
|
||||
"Wavelet/pkg/logger"
|
||||
"Wavelet/pkg/util"
|
||||
@@ -208,7 +209,7 @@ func RetryTask(ctx context.Context, id uint64) (string, error) {
|
||||
MaxRetry: execution.MaxRetry,
|
||||
RetryCount: execution.RetryCount + 1,
|
||||
Payload: execution.Payload,
|
||||
TriggeredBy: "retry",
|
||||
TriggeredBy: contracts.TaskTriggerRetry,
|
||||
}
|
||||
|
||||
if err := createTaskExecution(ctx, newExecution); err != nil {
|
||||
@@ -393,7 +394,7 @@ func getOrCreateTaskExecution(ctx context.Context, taskID string, t *asynq.Task,
|
||||
MaxRetry: meta.MaxRetry,
|
||||
RetryCount: 0,
|
||||
Payload: string(payload),
|
||||
TriggeredBy: "schedule",
|
||||
TriggeredBy: contracts.TaskTriggerSchedule,
|
||||
StartedAt: &now,
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ func (s *inprocScheduler) registerJob(ctx context.Context, def extpoints.Schedul
|
||||
|
||||
_, err := s.cronRunner.AddFunc(cronSpec, func() {
|
||||
if s.taskSvc != nil {
|
||||
if _, dispatchErr := s.taskSvc.Dispatch(ctx, taskType, payloadBytes, "inproc_cron"); dispatchErr != nil {
|
||||
if _, dispatchErr := s.taskSvc.Dispatch(ctx, taskType, payloadBytes, contracts.TaskTriggerSchedule); dispatchErr != nil {
|
||||
logger.ErrorF(ctx, "driver_inproc_cron: dispatch task %q failed: %v", taskType, dispatchErr)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -76,7 +76,7 @@ func (q *InprocQueue) Enqueue(ctx context.Context, taskType string, payload []by
|
||||
}
|
||||
|
||||
if source == "" {
|
||||
source = "manual"
|
||||
source = contracts.TaskTriggerManual
|
||||
}
|
||||
idType := td.Type
|
||||
if idType == "" {
|
||||
|
||||
Reference in New Issue
Block a user