mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -07:00
More headphones #32 I am starting to hate headphones... Sometimes the artists and albums just randomly fail.
This commit is contained in:
parent
f81b1de850
commit
13ee1efd86
3 changed files with 44 additions and 2 deletions
|
@ -24,7 +24,10 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -46,8 +49,8 @@ namespace PlexRequests.UI.Helpers
|
|||
RequestService = request;
|
||||
}
|
||||
|
||||
private int WaitTime => 1000;
|
||||
private int CounterMax => 30;
|
||||
private int WaitTime => 2000;
|
||||
private int CounterMax => 60;
|
||||
|
||||
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private IHeadphonesApi Api { get; }
|
||||
|
@ -103,12 +106,23 @@ namespace PlexRequests.UI.Helpers
|
|||
counter++;
|
||||
Log.Trace("Artist is still not present in the index. Counter = {0}", counter);
|
||||
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
|
||||
//Fetch failed name
|
||||
if (counter > CounterMax)
|
||||
{
|
||||
Log.Trace("Artist is still not present in the index. Counter = {0}. Returning false", counter);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
var addedArtist = index.FirstOrDefault(x => x.ArtistID == request.ArtistId);
|
||||
var artistName = addedArtist?.ArtistName ?? string.Empty;
|
||||
while (artistName.Contains("Fetch failed"))
|
||||
{
|
||||
await Api.RefreshArtist(Settings.ApiKey, Settings.FullUri, request.ArtistId);
|
||||
|
||||
index = await Api.GetIndex(Settings.ApiKey, Settings.FullUri);
|
||||
|
||||
artistName = index?.FirstOrDefault(x => x.ArtistID == request.ArtistId)?.ArtistName ?? string.Empty;
|
||||
}
|
||||
|
||||
counter = 0;
|
||||
var artistStatus = index.Where(x => x.ArtistID == request.ArtistId).Select(x => x.Status).FirstOrDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue