| @@ -10,7 +10,7 @@ import ( | |||||
| "gitlink.org.cn/cloudream/common/pkgs/future" | "gitlink.org.cn/cloudream/common/pkgs/future" | ||||
| "gitlink.org.cn/cloudream/common/pkgs/logger" | "gitlink.org.cn/cloudream/common/pkgs/logger" | ||||
| mylo "gitlink.org.cn/cloudream/common/utils/lo" | |||||
| "gitlink.org.cn/cloudream/common/utils/lo2" | |||||
| "gitlink.org.cn/cloudream/common/utils/serder" | "gitlink.org.cn/cloudream/common/utils/serder" | ||||
| clientv3 "go.etcd.io/etcd/client/v3" | clientv3 "go.etcd.io/etcd/client/v3" | ||||
| "go.etcd.io/etcd/client/v3/concurrency" | "go.etcd.io/etcd/client/v3/concurrency" | ||||
| @@ -84,7 +84,7 @@ func (a *AcquireActor) Acquire(ctx context.Context, req LockRequest) (string, er | |||||
| return | return | ||||
| } | } | ||||
| a.acquirings = mylo.Remove(a.acquirings, info) | |||||
| a.acquirings = lo2.Remove(a.acquirings, info) | |||||
| if info.LastErr != nil { | if info.LastErr != nil { | ||||
| info.Callback.SetError(info.LastErr) | info.Callback.SetError(info.LastErr) | ||||
| } else { | } else { | ||||
| @@ -213,7 +213,7 @@ func (a *AcquireActor) doAcquiring() error { | |||||
| } | } | ||||
| req.Callback.SetValue(reqData.ID) | req.Callback.SetValue(reqData.ID) | ||||
| a.acquirings = mylo.RemoveAt(a.acquirings, i) | |||||
| a.acquirings = lo2.RemoveAt(a.acquirings, i) | |||||
| break | break | ||||
| } | } | ||||
| @@ -8,7 +8,7 @@ import ( | |||||
| "github.com/google/uuid" | "github.com/google/uuid" | ||||
| "gitlink.org.cn/cloudream/common/pkgs/logger" | "gitlink.org.cn/cloudream/common/pkgs/logger" | ||||
| mylo "gitlink.org.cn/cloudream/common/utils/lo" | |||||
| "gitlink.org.cn/cloudream/common/utils/lo2" | |||||
| "gitlink.org.cn/cloudream/common/utils/serder" | "gitlink.org.cn/cloudream/common/utils/serder" | ||||
| clientv3 "go.etcd.io/etcd/client/v3" | clientv3 "go.etcd.io/etcd/client/v3" | ||||
| ) | ) | ||||
| @@ -191,6 +191,6 @@ func (a *ServiceInfoActor) OnLockRequestEvent(evt LockRequestEvent) { | |||||
| if evt.IsLocking { | if evt.IsLocking { | ||||
| status.LockRequestIDs = append(status.LockRequestIDs, evt.Data.ID) | status.LockRequestIDs = append(status.LockRequestIDs, evt.Data.ID) | ||||
| } else { | } else { | ||||
| status.LockRequestIDs = mylo.Remove(status.LockRequestIDs, evt.Data.ID) | |||||
| status.LockRequestIDs = lo2.Remove(status.LockRequestIDs, evt.Data.ID) | |||||
| } | } | ||||
| } | } | ||||
| @@ -5,7 +5,7 @@ import ( | |||||
| "sync" | "sync" | ||||
| "time" | "time" | ||||
| mylo "gitlink.org.cn/cloudream/common/utils/lo" | |||||
| "gitlink.org.cn/cloudream/common/utils/lo2" | |||||
| ) | ) | ||||
| type Manager[TCtx any] struct { | type Manager[TCtx any] struct { | ||||
| @@ -108,12 +108,12 @@ func (m *Manager[TCtx]) executeTask(task *Task[TCtx]) { | |||||
| // 立刻删除任务,或者延迟一段时间再删除 | // 立刻删除任务,或者延迟一段时间再删除 | ||||
| if opt.RemovingDelay == 0 { | if opt.RemovingDelay == 0 { | ||||
| m.tasks = mylo.Remove(m.tasks, task) | |||||
| m.tasks = lo2.Remove(m.tasks, task) | |||||
| } else { | } else { | ||||
| go func() { | go func() { | ||||
| <-time.After(opt.RemovingDelay) | <-time.After(opt.RemovingDelay) | ||||
| m.lock.Lock() | m.lock.Lock() | ||||
| m.tasks = mylo.Remove(m.tasks, task) | |||||
| m.tasks = lo2.Remove(m.tasks, task) | |||||
| m.lock.Unlock() | m.lock.Unlock() | ||||
| }() | }() | ||||
| } | } | ||||
| @@ -5,7 +5,7 @@ import ( | |||||
| "sync/atomic" | "sync/atomic" | ||||
| "time" | "time" | ||||
| mylo "gitlink.org.cn/cloudream/common/utils/lo" | |||||
| "gitlink.org.cn/cloudream/common/utils/lo2" | |||||
| ) | ) | ||||
| type CompleteOption struct { | type CompleteOption struct { | ||||
| @@ -82,7 +82,7 @@ func (t *Task[TCtx]) WaitTimeout(timeout time.Duration) bool { | |||||
| select { | select { | ||||
| case <-time.After(timeout): | case <-time.After(timeout): | ||||
| t.waiterLock.Lock() | t.waiterLock.Lock() | ||||
| t.waiters = mylo.Remove(t.waiters, waiter) | |||||
| t.waiters = lo2.Remove(t.waiters, waiter) | |||||
| t.waiterLock.Unlock() | t.waiterLock.Unlock() | ||||
| return false | return false | ||||
| @@ -3,7 +3,7 @@ package io | |||||
| import ( | import ( | ||||
| "io" | "io" | ||||
| "gitlink.org.cn/cloudream/common/utils/lo" | |||||
| "gitlink.org.cn/cloudream/common/utils/lo2" | |||||
| "gitlink.org.cn/cloudream/common/utils/math" | "gitlink.org.cn/cloudream/common/utils/math" | ||||
| ) | ) | ||||
| @@ -81,7 +81,7 @@ func (s *chunkedJoin) Read(buf []byte) (int, error) { | |||||
| } | } | ||||
| if err == io.EOF { | if err == io.EOF { | ||||
| s.inputs = lo.RemoveAt(s.inputs, s.currentInput) | |||||
| s.inputs = lo2.RemoveAt(s.inputs, s.currentInput) | |||||
| // 此处不需要+1 | // 此处不需要+1 | ||||
| if len(s.inputs) > 0 { | if len(s.inputs) > 0 { | ||||
| s.currentInput = s.currentInput % len(s.inputs) | s.currentInput = s.currentInput % len(s.inputs) | ||||
| @@ -1,4 +1,4 @@ | |||||
| package lo | |||||
| package lo2 | |||||
| import "github.com/samber/lo" | import "github.com/samber/lo" | ||||
| @@ -1,4 +1,4 @@ | |||||
| package lo | |||||
| package lo2 | |||||
| import ( | import ( | ||||
| "testing" | "testing" | ||||
| @@ -1,4 +1,4 @@ | |||||
| package sort | |||||
| package sort2 | |||||
| import ( | import ( | ||||
| "sort" | "sort" | ||||