mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2026-03-14 14:35:44 +01:00
Move ConcurrentMap to container package.
This commit is contained in:
parent
e478b93ba0
commit
f1a719cb23
3 changed files with 8 additions and 7 deletions
|
|
@ -427,7 +427,7 @@ func (b *BackendServer) sendRoomUpdate(roomid string, backend *Backend, notified
|
|||
}
|
||||
}
|
||||
|
||||
func (b *BackendServer) lookupByRoomSessionId(ctx context.Context, roomSessionId RoomSessionId, cache *ConcurrentMap[RoomSessionId, PublicSessionId]) (PublicSessionId, error) {
|
||||
func (b *BackendServer) lookupByRoomSessionId(ctx context.Context, roomSessionId RoomSessionId, cache *container.ConcurrentMap[RoomSessionId, PublicSessionId]) (PublicSessionId, error) {
|
||||
if roomSessionId == sessionIdNotInMeeting {
|
||||
b.logger.Printf("Trying to lookup empty room session id: %s", roomSessionId)
|
||||
return "", nil
|
||||
|
|
@ -452,7 +452,7 @@ func (b *BackendServer) lookupByRoomSessionId(ctx context.Context, roomSessionId
|
|||
return sid, nil
|
||||
}
|
||||
|
||||
func (b *BackendServer) fixupUserSessions(ctx context.Context, cache *ConcurrentMap[RoomSessionId, PublicSessionId], users []api.StringMap) []api.StringMap {
|
||||
func (b *BackendServer) fixupUserSessions(ctx context.Context, cache *container.ConcurrentMap[RoomSessionId, PublicSessionId], users []api.StringMap) []api.StringMap {
|
||||
if len(users) == 0 {
|
||||
return users
|
||||
}
|
||||
|
|
@ -504,7 +504,7 @@ func (b *BackendServer) sendRoomIncall(roomid string, backend *Backend, request
|
|||
ctx := log.NewLoggerContext(context.Background(), b.logger)
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
var cache ConcurrentMap[RoomSessionId, PublicSessionId]
|
||||
var cache container.ConcurrentMap[RoomSessionId, PublicSessionId]
|
||||
// Convert (Nextcloud) session ids to signaling session ids.
|
||||
request.InCall.Users = b.fixupUserSessions(ctx, &cache, request.InCall.Users)
|
||||
// Entries in "Changed" are most likely already fetched through the "Users" list.
|
||||
|
|
@ -528,7 +528,7 @@ func (b *BackendServer) sendRoomParticipantsUpdate(ctx context.Context, roomid s
|
|||
// Convert (Nextcloud) session ids to signaling session ids.
|
||||
ctx, cancel := context.WithTimeout(ctx, timeout)
|
||||
defer cancel()
|
||||
var cache ConcurrentMap[RoomSessionId, PublicSessionId]
|
||||
var cache container.ConcurrentMap[RoomSessionId, PublicSessionId]
|
||||
request.Participants.Users = b.fixupUserSessions(ctx, &cache, request.Participants.Users)
|
||||
request.Participants.Changed = b.fixupUserSessions(ctx, &cache, request.Participants.Changed)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package signaling
|
||||
package container
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
|
@ -19,9 +19,10 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package signaling
|
||||
package container
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
|
|
@ -83,7 +84,7 @@ func TestConcurrentStringStringMap(t *testing.T) {
|
|||
defer wg.Done()
|
||||
|
||||
key := "key-" + strconv.Itoa(x)
|
||||
rnd := newRandomString(32)
|
||||
rnd := rand.Text()
|
||||
for y := range count {
|
||||
value := rnd + "-" + strconv.Itoa(y)
|
||||
m.Set(key, value)
|
||||
Loading…
Add table
Add a link
Reference in a new issue