rename TestService to CheckService
This commit is contained in:
parent
6d64c86577
commit
21344a585e
2 changed files with 4 additions and 4 deletions
2
main.go
2
main.go
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue