feat(backend): fixed no sessID in storage service

This commit is contained in:
Alexander 2024-03-14 17:17:50 +01:00
parent 51a6d87e68
commit 36b6dfb5bd
4 changed files with 5 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"fmt"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@ -55,7 +56,7 @@ func main() {
} }
msg.Meta().SetMeta(oldMeta) msg.Meta().SetMeta(oldMeta)
} }
sessCtx := context.WithValue(context.Background(), "sessionID", msg.SessionID()) sessCtx := context.WithValue(context.Background(), "sessionID", fmt.Sprintf("%d", msg.SessionID()))
// Process session to save mob files to s3 // Process session to save mob files to s3
sesEnd := msg.(*messages.SessionEnd) sesEnd := msg.(*messages.SessionEnd)
if err := srv.Process(sessCtx, sesEnd); err != nil { if err := srv.Process(sessCtx, sesEnd); err != nil {

View file

@ -2089,5 +2089,5 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) {
case 111: case 111:
return DecodeIOSIssueEvent(reader) return DecodeIOSIssueEvent(reader)
} }
return nil, fmt.Errorf("Unknown message code: %v", t) return nil, fmt.Errorf("unknown message code: %v", t)
} }

View file

@ -96,7 +96,7 @@ func (s *sessionFinderImpl) worker() {
func (s *sessionFinderImpl) findSession(sessionID, timestamp, partition uint64) { func (s *sessionFinderImpl) findSession(sessionID, timestamp, partition uint64) {
sessEnd := &messages.SessionEnd{Timestamp: timestamp} sessEnd := &messages.SessionEnd{Timestamp: timestamp}
sessEnd.SetSessionID(sessionID) sessEnd.SetSessionID(sessionID)
ctx := context.WithValue(context.Background(), "sessionID", sessionID) ctx := context.WithValue(context.Background(), "sessionID", fmt.Sprintf("%d", sessionID))
err := s.storage.Process(ctx, sessEnd) err := s.storage.Process(ctx, sessEnd)
if err == nil { if err == nil {
s.log.Info(ctx, "found session in partition: %d, original: %d", s.log.Info(ctx, "found session in partition: %d, original: %d",

View file

@ -20,5 +20,5 @@ func ReadMessage(t uint64, reader BytesReader) (Message, error) {
case <%= msg.id %>: case <%= msg.id %>:
return Decode<%= msg.name %>(reader)<% end %> return Decode<%= msg.name %>(reader)<% end %>
} }
return nil, fmt.Errorf("Unknown message code: %v", t) return nil, fmt.Errorf("unknown message code: %v", t)
} }