aboutsummaryrefslogtreecommitdiff
path: root/models/webhook.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/webhook.go')
-rw-r--r--models/webhook.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/models/webhook.go b/models/webhook.go
index 7b6d7826..b4d7dc9c 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -465,7 +465,7 @@ func (q *UniqueQueue) Remove(id interface{}) {
delete(q.ids, com.ToStr(id))
}
-func (q *UniqueQueue) Add(id interface{}) {
+func (q *UniqueQueue) AddFunc(id interface{}, fn func()) {
newid := com.ToStr(id)
if q.Exist(id) {
@@ -474,10 +474,17 @@ func (q *UniqueQueue) Add(id interface{}) {
q.lock.Lock()
q.ids[newid] = true
+ if fn != nil {
+ fn()
+ }
q.lock.Unlock()
q.queue <- newid
}
+func (q *UniqueQueue) Add(id interface{}) {
+ q.AddFunc(id, nil)
+}
+
func (q *UniqueQueue) Exist(id interface{}) bool {
q.lock.Lock()
defer q.lock.Unlock()