rename TestService to CheckService

This commit is contained in:
Locria Cyber 2023-10-03 12:48:42 +00:00
parent 6d64c86577
commit 21344a585e
Signed by: iacore
GPG key ID: F8C16E5157A63006
2 changed files with 4 additions and 4 deletions

View file

@ -57,7 +57,7 @@ func rootPage(w http.ResponseWriter, r *http.Request) {
// get service status'
timeout := time.Second
ctx, cancel := context.WithTimeout(context.Background(), timeout)
data := scanner.TestServiceBatch(ctx, config.Service)
data := scanner.CheckServiceBatch(ctx, config.Service)
cancel()
// don't uncomment this in production. verbose

View file

@ -30,7 +30,7 @@ type ServiceStatus struct {
Status string
}
func TestService(service ServiceConfig, ctx context.Context) ServiceStatus {
func CheckService(service ServiceConfig, ctx context.Context) ServiceStatus {
var serviceResult bool
var status string
@ -70,7 +70,7 @@ func TestService(service ServiceConfig, ctx context.Context) ServiceStatus {
type ServiceStatusBatch []ServiceStatus
func TestServiceBatch(ctx Context, services []ServiceConfig) ServiceStatusBatch {
func CheckServiceBatch(ctx Context, services []ServiceConfig) ServiceStatusBatch {
var wg sync.WaitGroup
var data []ServiceStatus = make([]ServiceStatus, len(services))
@ -79,7 +79,7 @@ func TestServiceBatch(ctx Context, services []ServiceConfig) ServiceStatusBatch
wg.Add(1)
go func(i int, config ServiceConfig) {
defer wg.Done()
data[i] = TestService(config, ctx)
data[i] = CheckService(config, ctx)
}(i, v)
}
wg.Wait()