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) if (!string.IsNullOrWhiteSpace(domain) && domain != _settings.Domain)
return NotFound(); return NotFound();
try var user = await _twitterUserDal.GetTwitterUserAsync(name);
if (user is null)
{ {
await _twitterUserService.GetUserAsync(name); try
} {
catch (UserNotFoundException) await _twitterUserService.GetUserAsync(name);
{ }
return NotFound(); catch (UserNotFoundException)
} {
catch (UserHasBeenSuspendedException) return NotFound();
{ }
return NotFound(); catch (UserHasBeenSuspendedException)
} {
catch (RateLimitExceededException) return NotFound();
{ }
return new ObjectResult("Too Many Requests") { StatusCode = 429 }; catch (RateLimitExceededException)
} {
catch (Exception e) return new ObjectResult("Too Many Requests") { StatusCode = 429 };
{ }
_logger.LogError(e, "Exception getting {Name}", name); catch (Exception e)
throw; {
_logger.LogError(e, "Exception getting {Name}", name);
throw;
}
} }
var actorUrl = UrlFactory.GetActorUrl(_settings.Domain, name); var actorUrl = UrlFactory.GetActorUrl(_settings.Domain, name);