MCPcopy
hub / github.com/wailsapp/wails / queueingDispatcher

Function queueingDispatcher

v2/pkg/assetserver/assetserver_webview.go:162–185  ·  view source on GitHub ↗
(minQueueSize uint, inC <-chan T, outC chan<- T)

Source from the content-addressed store, hash-verified

160}
161
162func queueingDispatcher[T any](minQueueSize uint, inC <-chan T, outC chan<- T) {
163 q := newRingqueue[T](minQueueSize)
164 for {
165 in, ok := <-inC
166 if !ok {
167 return
168 }
169
170 q.Add(in)
171 for q.Len() != 0 {
172 out, _ := q.Peek()
173 select {
174 case outC <- out:
175 q.Remove()
176 case in, ok := <-inC:
177 if !ok {
178 return
179 }
180
181 q.Add(in)
182 }
183 }
184 }
185}

Callers 1

ServeWebViewRequestMethod · 0.85

Calls 4

PeekMethod · 0.80
AddMethod · 0.65
LenMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…