Skip to content

Commit

Permalink
Merge pull request #175 from getanteon/develop
Browse files Browse the repository at this point in the history
add env var for alive conn send
  • Loading branch information
fatihbaltaci authored Aug 6, 2024
2 parents cd390ed + 8775643 commit fb2202f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aggregator/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -1573,18 +1573,20 @@ func (a *Aggregator) sendOpenConnection(sl *SocketLine) {
}
}

// TODO: connection send is made here, sendOpenConnection must be called, refactor this func and its calling place
func (a *Aggregator) clearSocketLines(ctx context.Context) {
ticker := time.NewTicker(120 * time.Second)
skLineCh := make(chan *SocketLine, 1000)

sendAliveConnections, _ := strconv.ParseBool(os.Getenv("SEND_ALIVE_TCP_CONNECTIONS"))
go func() {
// spawn N goroutines to clear socket map
for i := 0; i < 10; i++ {
go func() {
for skLine := range skLineCh {
// send open connections to datastore
a.sendOpenConnection(skLine)
if sendAliveConnections {
a.sendOpenConnection(skLine)
}
// clear socket history
skLine.DeleteUnused()
}
Expand Down

0 comments on commit fb2202f

Please sign in to comment.