Proper checkUp

This commit is contained in:
mr
2026-03-17 15:12:29 +01:00
parent 7fbc077cb1
commit e422efd267
7 changed files with 23 additions and 85 deletions

View File

@@ -3,7 +3,6 @@ package infrastructure
import (
"encoding/json"
"fmt"
"sync"
"time"
oclib "cloud.o-forge.io/core/oc-lib"
@@ -15,9 +14,12 @@ import (
"cloud.o-forge.io/core/oc-lib/models/utils"
"cloud.o-forge.io/core/oc-lib/models/workflow"
"cloud.o-forge.io/core/oc-lib/tools"
"github.com/nats-io/nats.go"
)
func handleConfirm(resp tools.NATSResponse) {
confirmResource(string(resp.Payload), resp.Datatype)
}
func handlePlannerExecution(resp tools.NATSResponse) {
m := map[string]interface{}{}
p := planner.Planner{}
@@ -255,20 +257,3 @@ func confirmResource(id string, dt tools.DataType) {
}
}
}
// listenConfirmChannel subscribes to a NATS subject and calls confirmResource
// for each message received. The message body is expected to be the plain
// resource ID (UTF-8 string).
func listenConfirmChannel(nc *nats.Conn, subject string, dt tools.DataType, wg *sync.WaitGroup) {
defer wg.Done()
ch := make(chan *nats.Msg, 64)
sub, err := nc.ChanSubscribe(subject, ch)
if err != nil {
fmt.Printf("listenConfirmChannel: could not subscribe to %s: %v\n", subject, err)
return
}
defer sub.Unsubscribe()
for msg := range ch {
confirmResource(string(msg.Data), dt)
}
}