Refactor retry logic to reduce code duplication

- Extract retry condition check into ShouldRetryRequest() helper
- Extract backoff delay calculation into CalculateBackoffDelay() helper
- Use helper methods in both GetRecentTracksRequestFinished and GetTopTracksRequestFinished
- Improves code maintainability and consistency

Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-03 21:27:23 +00:00
parent 4c8103ef6d
commit 8bdbeeb5a8
2 changed files with 28 additions and 20 deletions

View File

@@ -80,6 +80,9 @@ class LastFMImport : public JsonBaseRequest {
void SendGetRecentTracksRequest(GetRecentTracksRequest request);
void SendGetTopTracksRequest(GetTopTracksRequest request);
bool ShouldRetryRequest(const JsonObjectResult &result) const;
int CalculateBackoffDelay(const int retry_count) const;
void Error(const QString &error, const QVariant &debug = QVariant()) override;
void UpdateTotalCheck();