MCPcopy Create free account
hub / github.com/Soypete/Production-Go-Examples / queueMessages

Method queueMessages

exercise-2/main.go:39–48  ·  view source on GitHub ↗

this will block and not close if the len(msgs) is larger than the channel buffer.

()

Source from the content-addressed store, hash-verified

37
38// this will block and not close if the len(msgs) is larger than the channel buffer.
39func (wp *workerPool) queueMessages() {
40 msgs := getMessages()
41 for _, msg := range msgs {
42 // add messages to string channel
43 wp.msgs <- msg
44 }
45
46 // close the worker channel and signal there won't be any more data
47 close(wp.msgs)
48}
49
50func (wp workerPool) detectWords() int {
51 var numWordsDetected int

Callers 1

mainFunction · 0.95

Calls 1

getMessagesFunction · 0.70

Tested by

no test coverage detected