File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ import (
2828 "math"
2929 "math/rand"
3030 "net/http"
31- "sync"
3231 "time"
3332
3433 "github.com/elastic/apm-aws-lambda/accumulator"
@@ -53,7 +52,6 @@ func (c *Client) ForwardApmData(ctx context.Context) error {
5352 c .logger .Warn ("Failed to start APM data forwarder due to client unhealthy" )
5453 return nil
5554 }
56- var once sync.Once
5755 var lambdaDataChan chan []byte
5856 for {
5957 select {
@@ -68,11 +66,12 @@ func (c *Client) ForwardApmData(ctx context.Context) error {
6866 if err := c .forwardAgentData (ctx , data ); err != nil {
6967 return err
7068 }
71- once . Do ( func () {
69+ if lambdaDataChan == nil {
7270 // With the first successful request to c.forwardAgent Data() metadata should be
7371 // available and processing data from c.LambdaDataChannel can start.
7472 lambdaDataChan = c .LambdaDataChannel
75- })
73+ c .logger .Debug ("Assigned Lambda data channel" )
74+ }
7675 case data := <- lambdaDataChan :
7776 if err := c .forwardLambdaData (ctx , data ); err != nil {
7877 return err
You can’t perform that action at this time.
0 commit comments