Log failure reasons of cache downloads
This commit is contained in:
parent
77d5ea36ae
commit
651bed91a0
@ -56,7 +56,7 @@ void CacheDownload::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
|
|||||||
void CacheDownload::downloadError(QNetworkReply::NetworkError error)
|
void CacheDownload::downloadError(QNetworkReply::NetworkError error)
|
||||||
{
|
{
|
||||||
// error happened during download.
|
// error happened during download.
|
||||||
// TODO: log the reason why
|
QLOG_ERROR() << "Failed" << m_url.toString() << "with reason" << error;
|
||||||
m_status = Job_Failed;
|
m_status = Job_Failed;
|
||||||
}
|
}
|
||||||
void CacheDownload::downloadFinished()
|
void CacheDownload::downloadFinished()
|
||||||
|
@ -54,18 +54,18 @@ void DownloadJob::partSucceeded(int index)
|
|||||||
partProgress(index, slot.total_progress, slot.total_progress);
|
partProgress(index, slot.total_progress, slot.total_progress);
|
||||||
|
|
||||||
num_succeeded++;
|
num_succeeded++;
|
||||||
QLOG_INFO() << m_job_name.toLocal8Bit() << " progress: " << num_succeeded << "/"
|
QLOG_INFO() << m_job_name.toLocal8Bit() << "progress:" << num_succeeded << "/"
|
||||||
<< downloads.size();
|
<< downloads.size();
|
||||||
if (num_failed + num_succeeded == downloads.size())
|
if (num_failed + num_succeeded == downloads.size())
|
||||||
{
|
{
|
||||||
if (num_failed)
|
if (num_failed)
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed.";
|
QLOG_ERROR() << m_job_name.toLocal8Bit() << "failed.";
|
||||||
emit failed();
|
emit failed();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QLOG_INFO() << m_job_name.toLocal8Bit() << " succeeded.";
|
QLOG_INFO() << m_job_name.toLocal8Bit() << "succeeded.";
|
||||||
emit succeeded();
|
emit succeeded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,17 +76,17 @@ void DownloadJob::partFailed(int index)
|
|||||||
auto &slot = parts_progress[index];
|
auto &slot = parts_progress[index];
|
||||||
if (slot.failures == 3)
|
if (slot.failures == 3)
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << "Part " << index << " failed 3 times (" << downloads[index]->m_url << ")";
|
QLOG_ERROR() << "Part" << index << "failed 3 times (" << downloads[index]->m_url << ")";
|
||||||
num_failed++;
|
num_failed++;
|
||||||
if (num_failed + num_succeeded == downloads.size())
|
if (num_failed + num_succeeded == downloads.size())
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << m_job_name.toLocal8Bit() << " failed.";
|
QLOG_ERROR() << m_job_name.toLocal8Bit() << "failed.";
|
||||||
emit failed();
|
emit failed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QLOG_ERROR() << "Part " << index << " failed, restarting (" << downloads[index]->m_url
|
QLOG_ERROR() << "Part" << index << "failed, restarting (" << downloads[index]->m_url
|
||||||
<< ")";
|
<< ")";
|
||||||
// restart the job
|
// restart the job
|
||||||
slot.failures++;
|
slot.failures++;
|
||||||
|
Loading…
Reference in New Issue
Block a user