Fix dumb bug

main
ilitirit 3 years ago
parent 6641fb3f77
commit 236b936c5c

@ -57,8 +57,6 @@ namespace Expedience.Api.Controllers
[HttpGet("UserName/{worldId}/{userHash}")]
public async Task<ActionResult> GetUserName(int worldId, string userHash, CancellationToken cancellationToken)
{
try
{
using var scope = _serviceScopeFactory.CreateScope();
using var dbContext = scope.ServiceProvider.GetRequiredService<ExpedienceContext>();
@ -79,7 +77,7 @@ namespace Expedience.Api.Controllers
isDuplicate = dbContext.Users.Any(x => x.WorldId == worldId && x.UserName == userName);
await Task.Delay(20, cancellationToken); // Don't hog the CPU
}
while (isDuplicate == false);
while (isDuplicate == true);
user = new User
{
@ -110,12 +108,5 @@ namespace Expedience.Api.Controllers
_logger.LogError("Could not acquire lock for {lockKey}", lockKey);
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error in GetUserName: {errorMessage}", ex.Message);
}
return StatusCode(500);
}
}
}

Loading…
Cancel
Save