mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 21:27:22 +01:00
allow connection when characteridentification is not null but it's the same user
This commit is contained in:
parent
a44c3c812f
commit
8f391c6afb
2 changed files with 7 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ namespace MareSynchronosServer.Hubs
|
|||
{
|
||||
_logger.LogInformation("Connection from " + userId);
|
||||
var user = (await _dbContext.Users.SingleAsync(u => u.UID == userId));
|
||||
if (!string.IsNullOrEmpty(user.CharacterIdentification))
|
||||
if (!string.IsNullOrEmpty(user.CharacterIdentification) && characterIdentification != user.CharacterIdentification)
|
||||
{
|
||||
return new ConnectionDto()
|
||||
{
|
||||
|
|
@ -86,6 +86,8 @@ namespace MareSynchronosServer.Hubs
|
|||
|
||||
public override async Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
MareMetrics.Connections.Dec();
|
||||
|
||||
var user = await _dbContext.Users.AsNoTracking().SingleOrDefaultAsync(u => u.UID == AuthenticatedUserId);
|
||||
if (user != null && !string.IsNullOrEmpty(user.CharacterIdentification))
|
||||
{
|
||||
|
|
@ -112,8 +114,6 @@ namespace MareSynchronosServer.Hubs
|
|||
await _dbContext.Users.CountAsync(u => !string.IsNullOrEmpty(u.CharacterIdentification)));
|
||||
}
|
||||
|
||||
MareMetrics.Connections.Dec();
|
||||
|
||||
await base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ namespace MareSynchronosServer
|
|||
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int worker, out int io);
|
||||
Console.WriteLine($"Before: Worker threads {worker}, IO threads {io}");
|
||||
System.Threading.ThreadPool.SetMaxThreads(worker, 10000);
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int workerNew, out int ioNew);
|
||||
Console.WriteLine($"After: Worker threads {workerNew}, IO threads {ioNew}");
|
||||
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
|
|
@ -41,6 +38,10 @@ namespace MareSynchronosServer
|
|||
context.RemoveRange(looseFiles);
|
||||
context.SaveChanges();
|
||||
|
||||
System.Threading.ThreadPool.SetMaxThreads(worker, context.Users.Count() * 5);
|
||||
System.Threading.ThreadPool.GetMaxThreads(out int workerNew, out int ioNew);
|
||||
Console.WriteLine($"After: Worker threads {workerNew}, IO threads {ioNew}");
|
||||
|
||||
MareMetrics.InitializeMetrics(context, services.GetRequiredService<IConfiguration>());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue