MCPcopy Index your code
hub / github.com/gogs/gogs / AddFunc

Method AddFunc

internal/sync/unique_queue.go:43–56  ·  view source on GitHub ↗

AddFunc adds new instance to the queue with a custom runnable function, the queue is blocked until the function exits.

(id any, fn func())

Source from the content-addressed store, hash-verified

41// AddFunc adds new instance to the queue with a custom runnable function,
42// the queue is blocked until the function exits.
43func (q *UniqueQueue) AddFunc(id any, fn func()) {
44 if q.Exist(id) {
45 return
46 }
47
48 idStr := com.ToStr(id)
49 q.table.Lock()
50 q.table.pool[idStr] = true
51 if fn != nil {
52 fn()
53 }
54 q.table.Unlock()
55 q.queue <- idStr
56}
57
58// Add adds new instance to the queue.
59func (q *UniqueQueue) Add(id any) {

Callers 3

AddMethod · 0.95
AddToTaskQueueMethod · 0.80
NewContextFunction · 0.80

Calls 2

ExistMethod · 0.95
fnFunction · 0.85

Tested by

no test coverage detected