mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-25 17:42:25 +01:00
fix: unable to start api
This commit is contained in:
17
core/utils/health.go
Normal file
17
core/utils/health.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/apex/log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func HandleHealthFn(healthFn func() bool, healthPort int) {
|
||||
addr := fmt.Sprintf(":%d", healthPort)
|
||||
go func() {
|
||||
if err := http.ListenAndServe(addr, nil); err != nil {
|
||||
log.Errorf("health check server failed: %v", err)
|
||||
}
|
||||
}()
|
||||
log.Infof("health check server started on port %d", healthPort)
|
||||
}
|
||||
Reference in New Issue
Block a user