Skip to content

Commit

Permalink
[bug] logtail client: change the channel to buffered one
Browse files Browse the repository at this point in the history
  • Loading branch information
volgariver6 committed Nov 6, 2024
1 parent 173985a commit 16c572f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/vm/engine/disttae/logtail_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ type connector struct {

func newConnector(c *PushClient, e *Engine) *connector {
co := &connector{
signal: make(chan struct{}),
signal: make(chan struct{}, 10),
client: c,
engine: e,
}
Expand Down Expand Up @@ -637,11 +637,15 @@ func (c *PushClient) sendConnectSig() {
return
}

select {
case c.connector.signal <- struct{}{}:
logutil.Infof("%s reconnect signal is received", logTag)
default:
logutil.Infof("%s connecting is in progress", logTag)
for {
select {
case c.connector.signal <- struct{}{}:
logutil.Infof("%s reconnect signal is received", logTag)
return
default:
logutil.Infof("%s reconnect chan is full", logTag)
time.Sleep(time.Second)
}
}
}

Expand Down

0 comments on commit 16c572f

Please sign in to comment.