timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
2 changed files with 4 additions and 10 deletions
Showing only changes of commit 7bae3575d5 - Show all commits

View File

@ -8,12 +8,8 @@ import (
"go.uber.org/zap"
)
var count uint64 = 0
func handle(msg *stomp.Message) {
start := time.Now()
count++
log.Info("Message received", zap.Uint64("total since startup", count))
schedule, err := unmarshalData(msg.Body)
if err != nil {
log.Error("Error unmarshalling VSTP Message", zap.Error(err))
@ -28,6 +24,6 @@ func handle(msg *stomp.Message) {
log.Error("Error processing VSTP Schedule", zap.Error(err))
}
end := time.Now()
duration := start.Sub(end)
duration := end.Sub(start)
log.Info("Message processed", zap.Duration("processing-time", duration))
}

View File

@ -1,7 +1,6 @@
package vstp
import (
"fmt"
"time"
"git.fjla.uk/owlboard/timetable-mgr/log"
@ -46,14 +45,13 @@ func Subscribe() {
for {
msg := <-sub.C
if msg.Err != nil {
log.Error("STOMP Message Error", zap.Error(msg.Err))
log.Error("VSTP Message Error", zap.Error(msg.Err))
} else {
if msg != nil {
log.Info("STOMP Message Received")
fmt.Println(string(msg.Body))
log.Info("VSTP Message Received")
handle(msg)
} else {
log.Info("STOMP Message Empty")
log.Info("VSTP Message Empty")
}
}
}