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

Method queueMessages

exercise-3/main.go:53–62  ·  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

51
52// this will block and not close if the len(msgs) is larger than the channel buffer.
53func (wp *workerPool) queueMessages() {
54 msgs := getMessages()
55 for _, msg := range msgs {
56 // add messages to string channel
57 wp.msgs <- msg
58 }
59
60 // close the worker channel and signal there won't be any more data
61 close(wp.msgs)
62}
63
64func (wp workerPool) detectWords() int {
65 var numWordsDetected int

Callers 1

mainFunction · 0.95

Calls 1

getMessagesFunction · 0.70

Tested by

no test coverage detected