Skip to content

Commit

Permalink
add logging if session saving fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Jul 15, 2024
1 parent cbfd295 commit 1d9c4dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/handler_convo.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,14 @@ func (s *server) Converse(ctx context.Context, stream *connect.BidiStream[pbconv
if err != nil {
evts.logEvent(fmt.Sprintf("ERROR %q AFTER %d seconds", err.Error(), int(time.Since(begin).Seconds())))
s.sessionLogger.SaveSession(start.Start.GeneratorId, evts.loggedEvents, lastState)
s.logger.Warn("failed to save session", zap.Error(err))
return err
}
evts.logEvent(fmt.Sprintf("COMPLETED IN %d seconds", int(time.Since(begin).Seconds())))

s.sessionLogger.SaveSession(start.Start.GeneratorId, evts.loggedEvents, lastState)
if err := s.sessionLogger.SaveSession(start.Start.GeneratorId, evts.loggedEvents, lastState); err != nil {
s.logger.Warn("failed to save session", zap.Error(err))
}
return io.EOF
})

Expand Down

0 comments on commit 1d9c4dc

Please sign in to comment.