testing and some small enhancement for http/429 stuff

This commit is contained in:
Martin Rotter 2025-02-14 14:29:30 +01:00
parent ad3069fd69
commit 8a69c11a55
4 changed files with 36 additions and 3 deletions

View file

@ -0,0 +1,4 @@
QProgressBar {
background-color: palette(highlight);
color: palette(window);
}

View file

@ -0,0 +1,24 @@
QListWidget,
QScrollArea {
border: 1px solid palette(light);
}
QPlainTextEdit:focus {
border: 1px solid palette(highlight);
}
QToolTip {
background-color: palette(window);
color: palette(text);
border: 1px solid palette(highlight);
border-radius: 2px;
}
QSplitter::handle {
background: palette(light);
}
QStatusBar::item {
border: none;
}

View file

@ -232,7 +232,8 @@ void FeedDownloader::updateOneFeed(ServiceRoot* acc,
qWarningNN << LOGSEC_CORE << "Feed with source" << QUOTE_W_SPACE(feed->source())
<< "was signalled temporarily being down. Returning no articles for now.";
feed->setStatus(Feed::Status::NetworkError, tr("feed is in network cooldown mode"));
feed->setStatus(Feed::Status::NetworkError,
tr("feed is in network cooldown mode due to making too many network requests"));
if (update_feed_list) {
acc->itemChanged({feed});

View file

@ -14,16 +14,20 @@
#include <QTextDocument>
#include <QTimer>
#define SECS_WHEN_RETRYAFTER_MISSING 120
QDateTime NetworkFactory::extractRetryAfter(const QString& retry_after_value) {
if (retry_after_value.simplified().isEmpty()) {
return {};
return QDateTime::currentDateTimeUtc().addSecs(SECS_WHEN_RETRYAFTER_MISSING);
}
bool is_int = false;
int seconds = retry_after_value.toInt(&is_int, 10);
if (is_int) {
return QDateTime::currentDateTimeUtc().addSecs(seconds);
// Some websites (Reddit) somehow return "0" Retry-After header value.
// In that case make it at least two minutes to wait.
return QDateTime::currentDateTimeUtc().addSecs(seconds <= 0 ? SECS_WHEN_RETRYAFTER_MISSING : seconds);
}
return QDateTime::fromString(retry_after_value.simplified().replace(QSL("GMT"), QSL("+0000")),