remove ZU.probability
This commit is contained in:
parent
85b703aa33
commit
a4cb8608da
3 changed files with 2 additions and 15 deletions
|
@ -80,7 +80,7 @@ Zotero.Debug = new function () {
|
|||
dump('zotero(' + level + ')' + (_time ? deltaStr : '') + ': ' + message + "\n\n");
|
||||
}
|
||||
if (_store) {
|
||||
if (Zotero.Utilities.prototype.probability(1000)) {
|
||||
if (Math.random() < 1/1000) {
|
||||
// Remove initial lines if over limit
|
||||
var overage = this.count() - Zotero.Prefs.get('debug.store.limit');
|
||||
if (overage > 0) {
|
||||
|
|
|
@ -406,19 +406,6 @@ Zotero.Utilities.prototype.rand = function (min, max) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true according to a given probability
|
||||
*
|
||||
* @param {Integer} x Will return true every x times on average
|
||||
* @return {Boolean} On average, TRUE every x times
|
||||
* the function is called
|
||||
*/
|
||||
Zotero.Utilities.prototype.probability = function (x) {
|
||||
return this.rand(1, x) == this.rand(1, x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Determine the necessary data type for SQLite parameter binding
|
||||
*
|
||||
|
|
|
@ -1377,7 +1377,7 @@ var Zotero = new function(){
|
|||
// DEBUG: this might not need to be permanent
|
||||
Zotero.Relations.purge();
|
||||
|
||||
if (!skipStoragePurge && Zotero.Utilities.prototype.probability(10)) {
|
||||
if (!skipStoragePurge && Math.random() < 1/10) {
|
||||
Zotero.Sync.Storage.purgeDeletedStorageFiles('zfs');
|
||||
Zotero.Sync.Storage.purgeDeletedStorageFiles('webdav');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue