Possible solution for #150.
This commit is contained in:
parent
79557e71e2
commit
245c0b08c3
@ -167,7 +167,7 @@ void Feed::run() {
|
|||||||
<< customId() << " in thread: \'"
|
<< customId() << " in thread: \'"
|
||||||
<< QThread::currentThreadId() << "\'.";
|
<< QThread::currentThreadId() << "\'.";
|
||||||
|
|
||||||
bool error_during_obtaining;
|
bool error_during_obtaining = false;
|
||||||
|
|
||||||
QList<Message> msgs = obtainNewMessages(&error_during_obtaining);
|
QList<Message> msgs = obtainNewMessages(&error_during_obtaining);
|
||||||
qDebug().nospace() << "Downloaded " << msgs.size() << " messages for feed "
|
qDebug().nospace() << "Downloaded " << msgs.size() << " messages for feed "
|
||||||
@ -215,7 +215,7 @@ int Feed::updateMessages(const QList<Message>& messages, bool error_during_obtai
|
|||||||
|
|
||||||
qDebug("Updating messages in DB. Main thread: '%s'.", qPrintable(is_main_thread ? "true" : "false"));
|
qDebug("Updating messages in DB. Main thread: '%s'.", qPrintable(is_main_thread ? "true" : "false"));
|
||||||
|
|
||||||
if (!error_during_obtaining) {
|
if (!messages.isEmpty()) {
|
||||||
bool anything_updated = false;
|
bool anything_updated = false;
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
@ -241,8 +241,9 @@ int Feed::updateMessages(const QList<Message>& messages, bool error_during_obtai
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
qCritical("I skip saving of messages into DB, as we have error during their downloading indicated.");
|
if (error_during_obtaining) {
|
||||||
|
qCritical("There is indication that there was error during messages obtaining.");
|
||||||
}
|
}
|
||||||
|
|
||||||
items_to_update.append(this);
|
items_to_update.append(this);
|
||||||
|
@ -16,7 +16,7 @@ InoreaderServiceRoot* InoreaderFeed::serviceRoot() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<Message> InoreaderFeed::obtainNewMessages(bool* error_during_obtaining) {
|
QList<Message> InoreaderFeed::obtainNewMessages(bool* error_during_obtaining) {
|
||||||
Feed::Status error;
|
Feed::Status error = Feed::Status::Normal;
|
||||||
QList<Message> messages = serviceRoot()->network()->messages(customId(), error);
|
QList<Message> messages = serviceRoot()->network()->messages(customId(), error);
|
||||||
|
|
||||||
setStatus(error);
|
setStatus(error);
|
||||||
|
@ -113,6 +113,7 @@ QList<Message> InoreaderNetworkFactory::messages(const QString& stream_id, Feed:
|
|||||||
QString bearer = m_oauth2->bearer().toLocal8Bit();
|
QString bearer = m_oauth2->bearer().toLocal8Bit();
|
||||||
|
|
||||||
if (bearer.isEmpty()) {
|
if (bearer.isEmpty()) {
|
||||||
|
qCritical("Cannot download messages for '%s', bearer is empty.", qPrintable(stream_id));
|
||||||
error = Feed::Status::AuthError;
|
error = Feed::Status::AuthError;
|
||||||
return QList<Message>();
|
return QList<Message>();
|
||||||
}
|
}
|
||||||
@ -126,6 +127,7 @@ QList<Message> InoreaderNetworkFactory::messages(const QString& stream_id, Feed:
|
|||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
if (downloader.lastOutputError() != QNetworkReply::NetworkError::NoError) {
|
if (downloader.lastOutputError() != QNetworkReply::NetworkError::NoError) {
|
||||||
|
qCritical("Cannot download messages for '%s', network error.", qPrintable(stream_id));
|
||||||
error = Feed::Status::NetworkError;
|
error = Feed::Status::NetworkError;
|
||||||
return QList<Message>();
|
return QList<Message>();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user