MCPcopy Create free account
hub / github.com/dave/blast / startLogLoop

Method startLogLoop

blaster/loop-log.go:7–35  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

5)
6
7func (b *Blaster) startLogLoop(ctx context.Context) {
8
9 if b.logWriter == nil {
10 return
11 }
12
13 b.mainWait.Add(1)
14
15 go func() {
16 defer b.mainWait.Done()
17 defer b.println("Exiting log loop")
18 var count uint64
19 for {
20 count++
21 select {
22 // don't react to ctx.Done() here because we may need to wait until workers have finished
23 case <-b.workersFinishedChannel:
24 // exit gracefully
25 return
26 case lr := <-b.logChannel:
27 b.logWriter.Write(lr.toCsv())
28 if count%1000 == 0 {
29 // notest
30 b.logWriter.Flush()
31 }
32 }
33 }
34 }()
35}

Callers 1

startMethod · 0.95

Calls 4

printlnMethod · 0.95
toCsvMethod · 0.80
FlushMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected