Skip to content

Commit

Permalink
Blacklist: Firewall errors are silenced for up to 1h only #4071
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Nov 25, 2015
1 parent 5216648 commit df63579
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libsync/syncjournalfilerecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,18 @@ SyncJournalErrorBlacklistRecord SyncJournalErrorBlacklistRecord::update(
entry._lastTryEtag = item._etag;
entry._lastTryTime = Utility::qDateTimeToTime_t(QDateTime::currentDateTime());
// The factor of 5 feels natural: 25s, 2 min, 10 min, ~1h, ~5h, ~24h
entry._ignoreDuration = qBound(minBlacklistTime, old._ignoreDuration * 5, maxBlacklistTime);
entry._ignoreDuration = old._ignoreDuration * 5;
entry._file = item._file;

if( item._httpErrorCode == 403 || item._httpErrorCode == 413 || item._httpErrorCode == 415 ) {
if (item._httpErrorCode == 403 && item._errorString.contains("firewall", Qt::CaseInsensitive)) {
qDebug() << "Firewall error: " << item._httpErrorCode << ", blacklisting up to 1h only";
entry._ignoreDuration = qMin(entry._ignoreDuration, time_t(60*60));

} else if( item._httpErrorCode == 403 || item._httpErrorCode == 413 || item._httpErrorCode == 415 ) {
qDebug() << "Fatal Error condition" << item._httpErrorCode << ", maximum blacklist ignore time!";
entry._ignoreDuration = maxBlacklistTime;
}
entry._ignoreDuration = qBound(minBlacklistTime, entry._ignoreDuration, maxBlacklistTime);

qDebug() << "blacklisting " << item._file
<< " for " << entry._ignoreDuration
Expand Down

0 comments on commit df63579

Please sign in to comment.