This commit is contained in:
@ -8,6 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"git.uploadfilter24.eu/covidnetes/woodpecker-autoscaler/internal/config"
|
||||
"git.uploadfilter24.eu/covidnetes/woodpecker-autoscaler/internal/models"
|
||||
@ -173,3 +174,12 @@ func RefreshNodeInfo(cfg *config.Config, serverID int) (*hcloud.Server, error) {
|
||||
}
|
||||
return server, nil
|
||||
}
|
||||
|
||||
func CheckRuntime(cfg *config.Config, server *hcloud.Server) (time.Duration, error) {
|
||||
server, err := RefreshNodeInfo(cfg, server.ID)
|
||||
now := time.Now()
|
||||
if err != nil {
|
||||
return time.Duration(0), errors.New(fmt.Sprintf("Could not check Runtime: %s", err.Error()))
|
||||
}
|
||||
return server.Created.Sub(now), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user