wellknown optimisation

This commit is contained in:
Vincent Cloutier 2023-07-12 19:54:51 -04:00
parent 5ac5555bf6
commit a6680df03e

View file

@ -201,26 +201,30 @@ namespace BirdsiteLive.Controllers
if (!string.IsNullOrWhiteSpace(domain) && domain != _settings.Domain)
return NotFound();
try
var user = await _twitterUserDal.GetTwitterUserAsync(name);
if (user is null)
{
await _twitterUserService.GetUserAsync(name);
}
catch (UserNotFoundException)
{
return NotFound();
}
catch (UserHasBeenSuspendedException)
{
return NotFound();
}
catch (RateLimitExceededException)
{
return new ObjectResult("Too Many Requests") { StatusCode = 429 };
}
catch (Exception e)
{
_logger.LogError(e, "Exception getting {Name}", name);
throw;
try
{
await _twitterUserService.GetUserAsync(name);
}
catch (UserNotFoundException)
{
return NotFound();
}
catch (UserHasBeenSuspendedException)
{
return NotFound();
}
catch (RateLimitExceededException)
{
return new ObjectResult("Too Many Requests") { StatusCode = 429 };
}
catch (Exception e)
{
_logger.LogError(e, "Exception getting {Name}", name);
throw;
}
}
var actorUrl = UrlFactory.GetActorUrl(_settings.Domain, name);