fix: Manager Add method

This commit is contained in:
langhuihui
2025-09-27 20:06:43 +08:00
parent d8962f4daa
commit 5c10fd13a5

View File

@@ -12,7 +12,7 @@ type Manager[K comparable, T ManagerItem[K]] struct {
func (m *Manager[K, T]) Add(ctx T, opt ...any) *Task {
ctx.OnStart(func() {
if old, ok := m.Get(ctx.GetKey()); !ok {
m.Add(ctx)
m.Collection.Add(ctx)
} else {
ctx.Stop(ExistTaskError{
Task: old,