aboutsummaryrefslogtreecommitdiff
path: root/internal/sync/unique_queue.go
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2023-02-02 21:25:25 +0800
committerGitHub <noreply@github.com>2023-02-02 21:25:25 +0800
commitc53a1998c589a544b25d53f6e6fdf0f24a4df25b (patch)
tree1c3c9d693ba551eecfbc535be942e40b5acf9cf7 /internal/sync/unique_queue.go
parent614382fec0ba05149785539ab93560d4d42c194d (diff)
all: replace `interface{}` with `any` (#7330)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Diffstat (limited to 'internal/sync/unique_queue.go')
-rw-r--r--internal/sync/unique_queue.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/sync/unique_queue.go b/internal/sync/unique_queue.go
index 48355019..cc0ea94f 100644
--- a/internal/sync/unique_queue.go
+++ b/internal/sync/unique_queue.go
@@ -38,13 +38,13 @@ func (q *UniqueQueue) Queue() <-chan string {
// Exist returns true if there is an instance with given indentity
// exists in the queue.
-func (q *UniqueQueue) Exist(id interface{}) bool {
+func (q *UniqueQueue) Exist(id any) bool {
return q.table.IsRunning(com.ToStr(id))
}
// AddFunc adds new instance to the queue with a custom runnable function,
// the queue is blocked until the function exits.
-func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
+func (q *UniqueQueue) AddFunc(id any, fn func()) {
if q.Exist(id) {
return
}
@@ -60,11 +60,11 @@ func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
}
// Add adds new instance to the queue.
-func (q *UniqueQueue) Add(id interface{}) {
+func (q *UniqueQueue) Add(id any) {
q.AddFunc(id, nil)
}
// Remove removes instance from the queue.
-func (q *UniqueQueue) Remove(id interface{}) {
+func (q *UniqueQueue) Remove(id any) {
q.table.Stop(com.ToStr(id))
}