Synchronize selected user access

This commit is contained in:
Brandon McGinty (chatgpt)
2026-08-10 00:42:09 -04:00
committed by Brandon McGinty
parent 20c6997ab0
commit 3efbd019ce
5 changed files with 49 additions and 21 deletions
+15
View File
@@ -84,6 +84,21 @@ func TestServerAddressDefaultsPortWithoutBreakingIPv6(t *testing.T) {
}
}
func TestConcurrentSelectedUserAccess(t *testing.T) {
b := &Barnard{}
user := &gumble.User{Session: 1}
var wg sync.WaitGroup
for i := 0; i < 20; i++ {
wg.Add(1)
go func(user *gumble.User) {
defer wg.Done()
b.setSelectedUserValue(user)
_ = b.selectedUserValue()
}(user)
}
wg.Wait()
}
func TestConcurrentMutedChannelAccess(t *testing.T) {
b := &Barnard{MutedChannels: make(map[uint32]bool)}
var wg sync.WaitGroup