add tests, 05 is broken

This commit is contained in:
gitGnome
2026-03-30 10:42:11 +02:00
parent c5fc74d142
commit 9fb5f952c5
12 changed files with 280 additions and 6 deletions
+22 -5
View File
@@ -146,12 +146,29 @@ func handleUnauthenticatedMessage(ctx context.Context, client *Client, clientMes
clientFromCache, err := CacheGetClientById(clientId)
if err != nil {
var msg = map[string]any{
"from": "server",
"error": "invalid token",
// Not in cache — load from database
dbClient := &Client{Id: clientId}
err = DbSetClientByIdWithoutGroups(ctx, dbClient)
if err != nil {
var msg = map[string]any{
"from": "server",
"error": "invalid client data",
}
sendMessageCloseIfTimeout(client, &msg)
return false
}
sendMessageCloseIfTimeout(client, &msg)
return false
err = DbSetClientGroups(ctx, dbClient)
if err != nil {
var msg = map[string]any{
"from": "server",
"error": "invalid client data",
}
sendMessageCloseIfTimeout(client, &msg)
return false
}
dbClient.WsConn = client.WsConn
CacheSaveClient(dbClient)
clientFromCache = dbClient
}
*client = *clientFromCache