#2 match owned nodes with pending/running tasks
All checks were successful
Pipeline was successful

This commit is contained in:
2023-11-06 21:13:24 +01:00
parent 98d48f006f
commit bbdcedf6de
2 changed files with 14 additions and 22 deletions

View File

@ -51,7 +51,7 @@ func main() {
log.WithFields(log.Fields{
"Caller": "Main",
}).Infof("Currently owning %d Agents", len(ownedNodes))
if pendingTasks {
if pendingTasks < len(ownedNodes) {
server, err := hetzner.CreateNewAgent(cfg)
if err != nil {
log.WithFields(log.Fields{
@ -86,7 +86,7 @@ func main() {
"Caller": "Main",
}).Fatal(fmt.Sprintf("Error checking woodpecker queue: %s", err.Error()))
}
if runningTasks {
if runningTasks <= len(ownedNodes) {
log.WithFields(log.Fields{
"Caller": "Main",
}).Info("Still found running tasks. No agent to be removed")