This commit is contained in:
@@ -248,10 +248,17 @@ namespace BritishHorseRacingApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
var content = response.Content;
|
var content = response.Content;
|
||||||
while (content.StartsWith("<"))
|
while (content.StartsWith("<") || content.StartsWith("Error: \"Failed to connect"))
|
||||||
{
|
{
|
||||||
|
if (!content.StartsWith("<"))
|
||||||
|
{
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(30));
|
||||||
|
response = await SendRequest(endpoint);
|
||||||
|
content = response.Content;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Delay(TimeSpan.FromSeconds(_waitTimeAfterFail));
|
await Task.Delay(TimeSpan.FromSeconds(_waitTimeAfterFail));
|
||||||
//_client.OutgoingPort++;
|
|
||||||
await GetNewToken();
|
await GetNewToken();
|
||||||
_client.DefaultHeaders.Items.RemoveAll(e => e.Key == "Accept-Language");
|
_client.DefaultHeaders.Items.RemoveAll(e => e.Key == "Accept-Language");
|
||||||
_client.DefaultHeaders.Items.Add(new KeyValuePair<string, string>("Accept-Language", $"en-US,en;q=0.9;id={Guid.NewGuid().ToString()}"));
|
_client.DefaultHeaders.Items.Add(new KeyValuePair<string, string>("Accept-Language", $"en-US,en;q=0.9;id={Guid.NewGuid().ToString()}"));
|
||||||
@@ -260,6 +267,7 @@ namespace BritishHorseRacingApi
|
|||||||
content = response.Content;
|
content = response.Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
throw new Exception($"Unexpected error: {content}" );
|
throw new Exception($"Unexpected error: {content}" );
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
namespace BritishHorseRacingApi.Models
|
namespace BritishHorseRacingApi.Models
|
||||||
{
|
{
|
||||||
public enum Status { Runner, Dnf, Withdrawn };
|
public enum Status { Runner, Dnf, Withdrawn, NonRunner };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user