1
0
Fork 0
mirror of https://github.com/Luzifer/elb-instance-status.git synced 2025-01-10 11:41:56 +00:00

Compare commits

..

No commits in common. "84df5e9f1aaabbf73ff6a7a006a61d2f48871f4c" and "879faa0a3685c83b9b82b595e2b42ca4e29ad9b0" have entirely different histories.

2 changed files with 2 additions and 20 deletions

View file

@ -1,7 +1,3 @@
# 1.1.2 / 2024-04-20
* Fix: Cleanup context after checks have run
# 1.1.1 / 2024-04-19
* Update dependencies

View file

@ -8,7 +8,6 @@ import (
"net/url"
"os"
"os/exec"
"sync"
"time"
"github.com/sirupsen/logrus"
@ -144,22 +143,9 @@ func loadChecks() error {
}
func spawnChecks() {
var wg sync.WaitGroup
ctx, cancel := context.WithTimeout(context.Background(), cfg.CheckInterval-time.Second)
wg.Add(len(checks))
go func() {
// Do not block the execution function but cleanup the context after
// all checks are done (or cancelled)
wg.Wait()
cancel()
}()
ctx, _ := context.WithTimeout(context.Background(), cfg.CheckInterval-time.Second)
for id := range checks {
go func(ctx context.Context, id string) {
defer wg.Done()
executeAndRegisterCheck(ctx, id)
}(ctx, id)
go executeAndRegisterCheck(ctx, id)
}
}