зеркало из https://github.com/mozilla/pjs.git
Bug 471299: retry code and comments in nsUrlClassifierStore::WriteEntry are wrong, r=dcamp
This commit is contained in:
Родитель
42c312e721
Коммит
c77609818d
|
@ -1937,25 +1937,17 @@ nsUrlClassifierStore::DeleteEntry(nsUrlClassifierEntry& entry)
|
|||
nsresult
|
||||
nsUrlClassifierStore::WriteEntry(nsUrlClassifierEntry& entry)
|
||||
{
|
||||
PRBool newEntry = (entry.mId == -1);
|
||||
if (entry.mId != -1) {
|
||||
// existing entry, just ignore it
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (newEntry) {
|
||||
// The insert statement chooses a random ID for the entry, which
|
||||
// might collide. This should be exceedingly rare, but we'll try
|
||||
// a few times, otherwise assume a real error.
|
||||
nsresult rv;
|
||||
for (PRUint32 i = 0; i < 10; i++) {
|
||||
mozStorageStatementScoper scoper(mInsertStatement);
|
||||
|
||||
rv = BindStatement(entry, mInsertStatement);
|
||||
nsresult rv = BindStatement(entry, mInsertStatement);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mInsertStatement->Execute();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRInt64 rowId;
|
||||
|
@ -1967,7 +1959,6 @@ nsUrlClassifierStore::WriteEntry(nsUrlClassifierEntry& entry)
|
|||
}
|
||||
|
||||
entry.mId = rowId;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче