mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 21:03:17 -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 response = client.Execute<T>(request);
|
||||
Log.Trace("Api Content Response:");
|
||||
Log.Trace(response.Content);
|
||||
|
||||
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
|
@ -85,9 +83,7 @@ namespace Ombi.Api
|
|||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
var response = client.Execute(request);
|
||||
Log.Trace("Request made to " + client.BaseUrl + " with details of " + request.ToString());
|
||||
Log.Trace("Api Content Response:");
|
||||
Log.Trace(response.Content);
|
||||
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
|
@ -104,9 +100,7 @@ namespace Ombi.Api
|
|||
{
|
||||
var client = new RestClient { BaseUrl = baseUri };
|
||||
var response = client.Execute(request);
|
||||
Log.Trace("Request made to " + client.BaseUrl + " with details of " + request.ToString());
|
||||
Log.Trace("Api Content Response:");
|
||||
Log.Trace(response.Content);
|
||||
Log.Trace($"Request made to {client.BaseUrl} with details of {request.ToString()}. The response was {response.Content}");
|
||||
if (response.ErrorException != null)
|
||||
{
|
||||
Log.Error(response.ErrorException);
|
||||
|
@ -114,10 +108,7 @@ namespace Ombi.Api
|
|||
throw new ApiRequestException(message, response.ErrorException);
|
||||
}
|
||||
|
||||
Log.Trace("Deserialzing Object");
|
||||
var json = JsonConvert.DeserializeObject<T>(response.Content, _settings);
|
||||
Log.Trace("Finished Deserialzing Object");
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ namespace Ombi.Core
|
|||
var artistExists = index.Any(x => x.ArtistID == request.ArtistId);
|
||||
if (!artistExists)
|
||||
{
|
||||
var artistAdd = Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
|
||||
Log.Info("Artist add result : {0}", artistAdd);
|
||||
var artistAdd = await Api.AddArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
|
||||
Log.Info("Artist add result for {1}: {0}", artistAdd, request.ArtistName);
|
||||
}
|
||||
|
||||
var counter = 0;
|
||||
|
@ -116,13 +116,13 @@ namespace Ombi.Core
|
|||
{
|
||||
Thread.Sleep(WaitTime);
|
||||
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);
|
||||
artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
|
||||
if (counter > CounterMax)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue