fix: various locks in the signaler

This commit is contained in:
Charles
2024-01-15 23:12:13 -08:00
parent 195cd67c90
commit 6851b30ad8
4 changed files with 13 additions and 7 deletions
+6 -2
View File
@@ -83,7 +83,8 @@ func main() {
// Wait for a session request
session, err := client.PopSession(ctx, withAuth(token, &pb.PopSessionRequest{}))
if err != nil {
if s, ok := status.FromError(err); ok && s.Code() == codes.NotFound {
code, hasCode := status.FromError(err)
if hasCode && code.Code() == codes.NotFound {
// try getting a new token
token, err = getAuthToken(ctx, client, cfg)
if err != nil {
@@ -91,7 +92,10 @@ func main() {
}
continue
}
log.Error().Err(err).Msg("error creating session")
log.Error().Err(err).Str("code", fmt.Sprintf("code %d", code.Code())).Bool("has code", hasCode).Msg("error creating session")
continue
}
if session.Msg.GetId() == nil {
continue
}
go handleSession(ctx, client, token, session, vid)