timing status checks
This commit is contained in:
parent
3a2141aab5
commit
9ae5f3b91d
@ -7,6 +7,7 @@ import (
|
||||
|
||||
"cloud.o-forge.io/core/oc-lib/config"
|
||||
"cloud.o-forge.io/core/oc-lib/dbs/mongo"
|
||||
"cloud.o-forge.io/core/oc-lib/logs"
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
@ -134,6 +135,8 @@ func (a *API) CheckRemotePeer(url string) (State, map[string]int) {
|
||||
|
||||
// CheckRemoteAPIs checks the state of remote APIs from your proper OC
|
||||
func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error) {
|
||||
l := logs.GetLogger()
|
||||
l.Debug().Msg("Start checking")
|
||||
// Check if the database is up
|
||||
new := map[string]string{}
|
||||
caller := NewHTTPCaller(map[DataType]map[METHOD]string{}) // Create a new http caller
|
||||
@ -142,6 +145,7 @@ func (a *API) CheckRemoteAPIs(apis []DataType) (State, map[string]string, error)
|
||||
state := ALIVE
|
||||
reachable := false
|
||||
for _, api := range apis { // Check the state of each remote API in the list
|
||||
l.Debug().Msg("Checking : " + api.String())
|
||||
var resp APIStatusResponse
|
||||
b, err := caller.CallGet("http://"+api.API()+":8080", "/oc/version/status") // Call the status endpoint of the remote API (standard OC status endpoint)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user