increase channel buffer sizes to handle thousands of devices
Raise write channel from 500 to 10000, SNMP/monitoring result channels from 1000 to 10000, MikroTik/credential channels to 5000. Prevents silent data loss when polling thousands of devices.
This commit is contained in:
parent
8b866ae946
commit
c57addc6c7
1 changed files with 5 additions and 5 deletions
10
agent.go
10
agent.go
|
|
@ -77,7 +77,7 @@ func runSession(ctx context.Context, baseURL, token string) error {
|
||||||
slog.Info("connected", "agent_id", agentID)
|
slog.Info("connected", "agent_id", agentID)
|
||||||
|
|
||||||
// Channel for serializing WebSocket writes
|
// Channel for serializing WebSocket writes
|
||||||
writeCh := make(chan []byte, 500)
|
writeCh := make(chan []byte, 10000)
|
||||||
|
|
||||||
// Worker pools — bounded concurrency for each job type
|
// Worker pools — bounded concurrency for each job type
|
||||||
pools := &jobPools{
|
pools := &jobPools{
|
||||||
|
|
@ -87,10 +87,10 @@ func runSession(ctx context.Context, baseURL, token string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result channels
|
// Result channels
|
||||||
snmpResultCh := make(chan *pb.SnmpResult, 1000)
|
snmpResultCh := make(chan *pb.SnmpResult, 10000)
|
||||||
mikrotikResultCh := make(chan *pb.MikrotikResult, 1000)
|
mikrotikResultCh := make(chan *pb.MikrotikResult, 5000)
|
||||||
credTestResultCh := make(chan *pb.CredentialTestResult, 1000)
|
credTestResultCh := make(chan *pb.CredentialTestResult, 5000)
|
||||||
monitoringCheckCh := make(chan *pb.MonitoringCheck, 1000)
|
monitoringCheckCh := make(chan *pb.MonitoringCheck, 10000)
|
||||||
|
|
||||||
// Ref counter for outbound messages
|
// Ref counter for outbound messages
|
||||||
var refCounter atomic.Uint64
|
var refCounter atomic.Uint64
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue