Skip to content

Commit 75c3d4f

Browse files
committed
refactor: One second between each API call (too much) global API config, and 10min request timeout.
1 parent 8d8a51b commit 75c3d4f

File tree

4 files changed

+3
-7
lines changed

4 files changed

+3
-7
lines changed

CFLookup/Jobs/GetLatestUpdatedModPerGame.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public async static Task RunAsync(PerformContext context)
2020
using (var scope = Program.ServiceProvider.CreateScope())
2121
{
2222
var cfClient = scope.ServiceProvider.GetRequiredService<ApiClient>();
23-
cfClient.RequestTimeout = TimeSpan.FromMinutes(10);
2423
var db = scope.ServiceProvider.GetRequiredService<MSSQLDB>();
2524
var _redis = scope.ServiceProvider.GetRequiredService<ConnectionMultiplexer>();
2625

CFLookup/Jobs/StoreCFApiFiles.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public async static Task RunAsync(PerformContext context, IJobCancellationToken
2727
try
2828
{
2929
var cfClient = scope.ServiceProvider.GetRequiredService<ApiClient>();
30-
cfClient.RequestDelay = TimeSpan.FromSeconds(0.05);
31-
cfClient.RequestTimeout = TimeSpan.FromMinutes(5);
3230

3331
var conn = scope.ServiceProvider.GetRequiredService<NpgsqlConnection>();
3432
await conn.OpenAsync();

CFLookup/Jobs/StoreCFApiProjects.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ public async static Task RunAsync(PerformContext context, IJobCancellationToken
2929
token.ThrowIfCancellationRequested();
3030

3131
var cfClient = scope.ServiceProvider.GetRequiredService<ApiClient>();
32-
cfClient.RequestDelay = TimeSpan.FromSeconds(0.05);
33-
cfClient.RequestTimeout = TimeSpan.FromMinutes(5);
3432

3533
var conn = scope.ServiceProvider.GetRequiredService<NpgsqlConnection>();
3634
await conn.OpenAsync();

CFLookup/Program.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ private static async Task Main(string[] args)
128128
{
129129
});
130130
#endif
131-
builder.Services.AddScoped(options =>
131+
builder.Services.AddScoped(options => new CurseForge.APIClient.ApiClient(cfApiKey, 201, "whatcfprojectisthat@nolifeking85.tv")
132132
{
133-
return new CurseForge.APIClient.ApiClient(cfApiKey, 201, "whatcfprojectisthat@nolifeking85.tv");
133+
RequestDelay = TimeSpan.FromSeconds(1),
134+
RequestTimeout = TimeSpan.FromMinutes(10)
134135
});
135136

136137
var app = builder.Build();

0 commit comments

Comments
 (0)