Sleep more if there are too many requests.

This commit is contained in:
Filip Strajnar 2024-06-16 01:42:35 +02:00
parent 797ca91314
commit fce225ee0c

View file

@ -32,6 +32,12 @@ int finalCode = await CommandLine
);
message.LastHttpCode = (int)response.StatusCode;
if (response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)
{
Console.WriteLine("Too many requests. Sleeping for extra 20 seconds.");
await Task.Delay(TimeSpan.FromSeconds(20));
}
db.Update(message);
await db.SaveChangesAsync();