DeleteRoom now removes all participants in the room

This commit is contained in:
David Zhao
2021-04-21 22:30:29 -07:00
parent 4725872884
commit 0dddc3c0be
5 changed files with 47 additions and 12 deletions
+1
View File
@@ -7,6 +7,7 @@ var (
ErrHandlerNotDefined = errors.New("handler not defined")
ErrNoAvailableNodes = errors.New("could not find any available nodes")
ErrIncorrectRTCNode = errors.New("current node isn't the RTC node for the room")
ErrNodeNotFound = errors.New("could not locate the node")
errInvalidRouterMessage = errors.New("invalid router message")
ErrChannelClosed = errors.New("channel closed")
ErrChannelFull = errors.New("channel is full")
+10 -2
View File
@@ -273,11 +273,19 @@ func (r *RedisRouter) setParticipantSignalNode(connectionId, nodeId string) erro
}
func (r *RedisRouter) getParticipantRTCNode(participantKey string) (string, error) {
return r.rc.Get(r.ctx, participantRTCKey(participantKey)).Result()
val, err := r.rc.Get(r.ctx, participantRTCKey(participantKey)).Result()
if err == redis.Nil {
err = ErrNodeNotFound
}
return val, err
}
func (r *RedisRouter) getParticipantSignalNode(connectionId string) (nodeId string, err error) {
return r.rc.Get(r.ctx, participantSignalKey(connectionId)).Result()
val, err := r.rc.Get(r.ctx, participantSignalKey(connectionId)).Result()
if err == redis.Nil {
err = ErrNodeNotFound
}
return val, err
}
// update node stats and cleanup