refactor(backend): use single shared HTTP client with backoff
This commit is contained in:
parent
bba322bd22
commit
5d452824cd
9 changed files with 232 additions and 75 deletions
|
@ -27,6 +27,7 @@ using NodaTime.Text;
|
|||
namespace Foxnouns.Backend.Jobs;
|
||||
|
||||
public class CreateDataExportJob(
|
||||
HttpClient client,
|
||||
DatabaseContext db,
|
||||
IClock clock,
|
||||
UserRendererService userRenderer,
|
||||
|
@ -36,7 +37,6 @@ public class CreateDataExportJob(
|
|||
ILogger logger
|
||||
)
|
||||
{
|
||||
private static readonly HttpClient Client = new();
|
||||
private readonly ILogger _logger = logger.ForContext<CreateDataExportJob>();
|
||||
|
||||
public static void Enqueue(Snowflake userId)
|
||||
|
@ -201,7 +201,7 @@ public class CreateDataExportJob(
|
|||
if (s3Path == null)
|
||||
return;
|
||||
|
||||
HttpResponseMessage resp = await Client.GetAsync(s3Path);
|
||||
HttpResponseMessage resp = await client.GetAsync(s3Path);
|
||||
if (resp.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
_logger.Warning("S3 path {S3Path} returned a non-200 status, not saving file", s3Path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue