Fixed compiler warnings.

This commit is contained in:
Tom
2024-12-28 17:24:02 +00:00
parent 525725a7e5
commit 538bf07454
30 changed files with 108 additions and 105 deletions

View File

@@ -23,27 +23,32 @@ namespace HermesSocketServer.Services
}
public async Task<Channel?> Add(string userId)
public Task<Channel?> Add(string userId)
{
var user = _users.Get(userId);
if (user == null)
{
return null;
return Task.FromResult<Channel?>(null);
}
lock (_lock)
{
if (_channels.ContainsKey(userId))
{
return null;
return Task.FromResult<Channel?>(null);
}
var chatters = new ChatterStore(userId, _database, _logger);
var policies = new PolicyStore(userId, _database, _logger);
var filters = new TTSFilterStore(userId, _database, _logger);
var actions = new ActionStore(userId, _database, _logger);
var redemptions = new RedemptionStore(userId, _database, _logger);
Task.WaitAll([
chatters.Load(),
policies.Load(),
filters.Load(),
actions.Load(),
redemptions.Load(),
]);
var channel = new Channel()
@@ -53,10 +58,12 @@ namespace HermesSocketServer.Services
Chatters = chatters,
Policies = policies,
Filters = filters,
Actions = actions,
Redemptions = redemptions,
};
_channels.Add(userId, channel);
return channel;
return Task.FromResult<Channel?>(channel);
}
}
@@ -76,6 +83,8 @@ namespace HermesSocketServer.Services
channel.Chatters.Save(),
channel.Policies.Save(),
channel.Filters.Save(),
channel.Actions.Save(),
channel.Redemptions.Save(),
]);
}
@@ -88,6 +97,8 @@ namespace HermesSocketServer.Services
channel.Chatters.Save(),
channel.Policies.Save(),
channel.Filters.Save(),
channel.Actions.Save(),
channel.Redemptions.Save(),
]);
}
}