feat: Removed comments
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Package monitors runs agent-side service checks. It polls the server for the
|
||||
// monitors assigned to this agent (SyncMonitors), runs each on its own interval
|
||||
// using the local checker package, and reports results back (ReportChecks).
|
||||
|
||||
|
||||
|
||||
package monitors
|
||||
|
||||
import (
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/mrhid6/vantage/agent/internal/grpc/pb"
|
||||
)
|
||||
|
||||
// syncInterval controls how often the agent re-fetches its assigned monitors.
|
||||
|
||||
const syncInterval = 30 * time.Second
|
||||
|
||||
type runner struct {
|
||||
@@ -23,13 +23,13 @@ type runner struct {
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
// Run starts the agent monitor loop and blocks until ctx is cancelled.
|
||||
|
||||
func Run(ctx context.Context, cfg *config.Config) {
|
||||
active := map[string]*runner{}
|
||||
var mu sync.Mutex
|
||||
|
||||
// results is a shared channel every check writes to; a single reporter
|
||||
// goroutine batches and ships them so we make one ReportChecks call per tick.
|
||||
|
||||
|
||||
results := make(chan pb.CheckResult, 64)
|
||||
go reporter(ctx, cfg, results)
|
||||
|
||||
@@ -128,7 +128,7 @@ func runSpec(ctx context.Context, s pb.MonitorSpec, out chan<- pb.CheckResult) {
|
||||
}
|
||||
}
|
||||
|
||||
// reporter batches results on a short interval and ships each batch in one call.
|
||||
|
||||
func reporter(ctx context.Context, cfg *config.Config, in <-chan pb.CheckResult) {
|
||||
t := time.NewTicker(5 * time.Second)
|
||||
defer t.Stop()
|
||||
|
||||
Reference in New Issue
Block a user