fix: mark knowledge delete failures after retry exhaustion
This commit is contained in:
@@ -16,6 +16,7 @@ package asynqdl
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/internal/logger"
|
||||
"github.com/Tencent/WeKnora/internal/types"
|
||||
@@ -164,6 +165,7 @@ func buildDeadLetter(t *asynq.Task, taskErr error, attempts int) *types.TaskDead
|
||||
Payload: json.RawMessage(rawPayload),
|
||||
LastError: truncateError(taskErr.Error(), 8192),
|
||||
FailCount: attempts,
|
||||
FailedAt: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,9 @@ func TestMiddleware_FailureWithoutAsynqCtx_RecordsRow(t *testing.T) {
|
||||
if row.FailCount != 0 {
|
||||
t.Errorf("fail_count: expected 0 outside worker ctx, got %d", row.FailCount)
|
||||
}
|
||||
if row.FailedAt.IsZero() {
|
||||
t.Error("failed_at: expected non-zero timestamp")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMiddleware_UnknownPayload_StillRecords(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user