Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Commit b1a1ae3

Browse files
committed
create channel outside the tomb
1 parent 3a4a84c commit b1a1ae3

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

agent/recorder.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func NewSpanRecorder(agent *Agent) *SpanRecorder {
101101
r.stats = &RecorderStats{}
102102
r.logger.Printf("recorder frequency: %v", agent.flushFrequency)
103103
r.logger.Printf("recorder concurrency level: %v", agent.concurrencyLevel)
104+
104105
// start workers
105106
r.workerJobs = make(chan *workerJob, r.concurrencyLevel)
106107
r.workerResults = make(chan *workerResult, r.concurrencyLevel)
@@ -128,18 +129,8 @@ func (r *SpanRecorder) RecordSpan(span tracer.RawSpan) {
128129

129130
func (r *SpanRecorder) loop() error {
130131
defer func() {
131-
close(r.workerJobs)
132-
close(r.workerResults)
133132
r.logger.Println("recorder has been stopped.")
134133
}()
135-
136-
// start workers
137-
r.workerJobs = make(chan *workerJob, r.concurrencyLevel)
138-
r.workerResults = make(chan *workerResult, r.concurrencyLevel)
139-
for i := 0; i < r.concurrencyLevel; i++ {
140-
go r.worker(i + 1)
141-
}
142-
143134
ticker := time.NewTicker(1 * time.Second)
144135
cTime := time.Now()
145136
for {

0 commit comments

Comments
 (0)