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" "go.uber.org/zap"
) )
var count uint64 = 0
func handle(msg *stomp.Message) { func handle(msg *stomp.Message) {
start := time.Now() start := time.Now()
count++
log.Info("Message received", zap.Uint64("total since startup", count))
schedule, err := unmarshalData(msg.Body) schedule, err := unmarshalData(msg.Body)
if err != nil { if err != nil {
log.Error("Error unmarshalling VSTP Message", zap.Error(err)) 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)) log.Error("Error processing VSTP Schedule", zap.Error(err))
} }
end := time.Now() end := time.Now()
duration := start.Sub(end) duration := end.Sub(start)
log.Info("Message processed", zap.Duration("processing-time", duration)) log.Info("Message processed", zap.Duration("processing-time", duration))
} }

View File

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