mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-12-24 13:48:04 +08:00
fix: Manager Add method
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user