mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 04:49:33 -07:00
Added a missing await
for an HP AddArtist call. Added some more Trace logging.
This commit is contained in:
parent
f931750f98
commit
e57cdf8c6f
2 changed files with 7 additions and 16 deletions
|
@ -58,9 +58,7 @@ namespace Ombi.Api
|
||||||
var client = new RestClient { BaseUrl = baseUri };
|
var client = new RestClient { BaseUrl = baseUri };
|
||||||
|
|
||||||
var response = client.Execute<T>(request);
|
var response = client.Execute<T>(request);
|
||||||
Log.Trace("Api Content Response:");
|
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||||
Log.Trace(response.Content);
|
|
||||||
|
|
||||||
|
|
||||||
if (response.ErrorException != null)
|
if (response.ErrorException != null)
|
||||||
{
|
{
|
||||||
|
@ -85,9 +83,7 @@ namespace Ombi.Api
|
||||||
{
|
{
|
||||||
var client = new RestClient { BaseUrl = baseUri };
|
var client = new RestClient { BaseUrl = baseUri };
|
||||||
var response = client.Execute(request);
|
var response = client.Execute(request);
|
||||||
Log.Trace("Request made to " + client.BaseUrl + " with details of " + request.ToString());
|
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||||
Log.Trace("Api Content Response:");
|
|
||||||
Log.Trace(response.Content);
|
|
||||||
|
|
||||||
if (response.ErrorException != null)
|
if (response.ErrorException != null)
|
||||||
{
|
{
|
||||||
|
@ -104,9 +100,7 @@ namespace Ombi.Api
|
||||||
{
|
{
|
||||||
var client = new RestClient { BaseUrl = baseUri };
|
var client = new RestClient { BaseUrl = baseUri };
|
||||||
var response = client.Execute(request);
|
var response = client.Execute(request);
|
||||||
Log.Trace("Request made to " + client.BaseUrl + " with details of " + request.ToString());
|
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||||
Log.Trace("Api Content Response:");
|
|
||||||
Log.Trace(response.Content);
|
|
||||||
if (response.ErrorException != null)
|
if (response.ErrorException != null)
|
||||||
{
|
{
|
||||||
Log.Error(response.ErrorException);
|
Log.Error(response.ErrorException);
|
||||||
|
@ -114,10 +108,7 @@ namespace Ombi.Api
|
||||||
throw new ApiRequestException(message, response.ErrorException);
|
throw new ApiRequestException(message, response.ErrorException);
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.Trace("Deserialzing Object");
|
|
||||||
var json = JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
var json = JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
||||||
Log.Trace("Finished Deserialzing Object");
|
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,8 +90,8 @@ namespace Ombi.Core
|
||||||
var artistExists = index.Any(x => x.ArtistID == request.ArtistId);
|
var artistExists = index.Any(x => x.ArtistID == request.ArtistId);
|
||||||
if (!artistExists)
|
if (!artistExists)
|
||||||
{
|
{
|
||||||
var artistAdd = Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
|
var artistAdd = await Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
|
||||||
Log.Info("Artist add result : {0}", artistAdd);
|
Log.Info("Artist add result for {1}: {0}", artistAdd, request.ArtistName);
|
||||||
}
|
}
|
||||||
|
|
||||||
var counter = 0;
|
var counter = 0;
|
||||||
|
@ -116,13 +116,13 @@ namespace Ombi.Core
|
||||||
{
|
{
|
||||||
Thread.Sleep(WaitTime);
|
Thread.Sleep(WaitTime);
|
||||||
counter++;
|
counter++;
|
||||||
Log.Trace("Artist status {1}. Counter = {0}", counter, artistStatus);
|
Log.Trace("Artist {2} status {1}. Counter = {0}", counter, artistStatus, request.ArtistName);
|
||||||
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
|
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
|
||||||
artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
|
artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
|
||||||
if (counter > CounterMax)
|
if (counter > CounterMax)
|
||||||
{
|
{
|
||||||
Log.Trace("Artist status is still not active. Counter = {0}. Returning false", counter);
|
Log.Trace("Artist status is still not active. Counter = {0}. Returning false", counter);
|
||||||
Log.Warn("The artist status is still not Active. We have waited long enough, seems to be a big delay in headphones.");
|
Log.Warn($"The artist status for {request.ArtistName} is still not Active. We have waited long enough, seems to be a big delay in headphones.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue