fixed cron schedule again, error handling scrobble
scrobble request and mapping
This commit is contained in:
parent
349d62b5cc
commit
12842c240b
@ -124,7 +124,7 @@ namespace Selector.CLI
|
|||||||
public const string Key = "Scrobble";
|
public const string Key = "Scrobble";
|
||||||
|
|
||||||
public bool Enabled { get; set; } = true;
|
public bool Enabled { get; set; } = true;
|
||||||
public string FullScrobbleCron { get; set; } = "0 0 2 * * *";
|
public string FullScrobbleCron { get; set; } = "0 0 2 * * ?";
|
||||||
public TimeSpan InterJobDelay { get; set; } = TimeSpan.FromMinutes(5);
|
public TimeSpan InterJobDelay { get; set; } = TimeSpan.FromMinutes(5);
|
||||||
public TimeSpan InterRequestDelay { get; set; } = TimeSpan.FromMilliseconds(100);
|
public TimeSpan InterRequestDelay { get; set; } = TimeSpan.FromMilliseconds(100);
|
||||||
public DateTime? From { get; set; } = DateTime.UtcNow.AddDays(-14);
|
public DateTime? From { get; set; } = DateTime.UtcNow.AddDays(-14);
|
||||||
|
@ -44,6 +44,8 @@ namespace Selector
|
|||||||
var netTime = Stopwatch.StartNew();
|
var netTime = Stopwatch.StartNew();
|
||||||
currentTask = searchClient.Item(new (QueryType, Query));
|
currentTask = searchClient.Item(new (QueryType, Query));
|
||||||
currentTask.ContinueWith(async t =>
|
currentTask.ContinueWith(async t =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
netTime.Stop();
|
netTime.Stop();
|
||||||
logger.LogTrace("Network request took {:n} ms", netTime.ElapsedMilliseconds);
|
logger.LogTrace("Network request took {:n} ms", netTime.ElapsedMilliseconds);
|
||||||
@ -68,6 +70,12 @@ namespace Selector
|
|||||||
AggregateTaskSource.SetException(t.Exception);
|
AggregateTaskSource.SetException(t.Exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, "Error while mapping Last.fm {} ({}) to Spotify on attempt {}", Query, QueryType, Attempts);
|
||||||
|
Succeeded = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Attempts++;
|
Attempts++;
|
||||||
|
@ -55,6 +55,8 @@ namespace Selector
|
|||||||
var netTime = Stopwatch.StartNew();
|
var netTime = Stopwatch.StartNew();
|
||||||
currentTask = userClient.GetRecentScrobbles(username, pagenumber: pageNumber, count: pageSize, from: from, to: to);
|
currentTask = userClient.GetRecentScrobbles(username, pagenumber: pageNumber, count: pageSize, from: from, to: to);
|
||||||
currentTask.ContinueWith(async t =>
|
currentTask.ContinueWith(async t =>
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
netTime.Stop();
|
netTime.Stop();
|
||||||
logger.LogTrace("Network request took {:n} ms", netTime.ElapsedMilliseconds);
|
logger.LogTrace("Network request took {:n} ms", netTime.ElapsedMilliseconds);
|
||||||
@ -90,6 +92,12 @@ namespace Selector
|
|||||||
logger.LogError("Scrobble request task faulted, {}", t.Exception);
|
logger.LogError("Scrobble request task faulted, {}", t.Exception);
|
||||||
AggregateTaskSource.SetException(t.Exception);
|
AggregateTaskSource.SetException(t.Exception);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
logger.LogError(e, "Error while making scrobble request #{} for {} by {} from {} to {} on attempt {}", pageNumber, username, pageSize, from, to, Attempts);
|
||||||
|
Succeeded = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Attempts++;
|
Attempts++;
|
||||||
|
Loading…
Reference in New Issue
Block a user