MCPcopy Create free account
hub / github.com/egonelbre/exp / ProcessFile

Function ProcessFile

progress/main.go:132–154  ·  view source on GitHub ↗
(char rune)

Source from the content-addressed store, hash-verified

130var Processing Processes
131
132func ProcessFile(char rune) {
133 process := &Process{}
134 process.Name = string(char)
135
136 go func() {
137 defer process.Done()
138
139 tick := time.NewTicker(time.Millisecond * time.Duration(rand.Intn(100)+100))
140 defer tick.Stop()
141
142 k := 0
143 for range tick.C {
144 process.Update(k)
145 k++
146 if rand.Intn(500) == 0 {
147 process.Fail(errors.New("we got a zeeero"))
148 return
149 }
150 }
151 }()
152
153 Processing.Add(process)
154}
155
156func main() {
157 go Listen()

Callers 1

mainFunction · 0.85

Calls 6

DoneMethod · 0.95
UpdateMethod · 0.95
FailMethod · 0.95
StopMethod · 0.65
AddMethod · 0.65
DurationMethod · 0.45

Tested by

no test coverage detected