fix(task): execute dispatched jobs and persist run records

Asynq func handlers now go through ProcessTask so admin execution
rows leave pending. The in-process worker resolves admin type
identifiers and writes the same w_task_executions table. Remove
the no-op admin system_cleanup that shadowed the upload handler.
This commit is contained in:
ryan
2026-09-02 16:11:45 +08:00
parent 33f28ad671
commit 30bbe965bf
14 changed files with 530 additions and 82 deletions
+4
View File
@@ -221,6 +221,10 @@ func TestTaskExtension(t *testing.T) {
assert.True(t, ok)
assert.Equal(t, "order:cancel_timeout", task.Pattern)
byType, ok := tr.Get("cancel_timeout")
assert.True(t, ok, "Get should resolve admin type identifier")
assert.Equal(t, "order:cancel_timeout", byType.Pattern)
_, ok = tr.Get("unknown")
assert.False(t, ok)
}
+10 -3
View File
@@ -276,10 +276,17 @@ func (t *TaskRegistry) Tasks() []TaskDefinition {
return res
}
// Get retrieves a task definition by its pattern.
// Get retrieves a task definition by its pattern or admin type identifier.
func (t *TaskRegistry) Get(pattern string) (TaskDefinition, bool) {
t.mu.RLock()
defer t.mu.RUnlock()
td, ok := t.lookup[pattern]
return td, ok
if td, ok := t.lookup[pattern]; ok {
return td, true
}
for _, td := range t.tasks {
if td.Type == pattern {
return td, true
}
}
return TaskDefinition{}, false
}