Temporary prefs buttons to debug slow DB issue
This commit is contained in:
parent
c6b78da69d
commit
249f9c6495
|
@ -31,6 +31,12 @@
|
|||
<button id="openAboutMemory"
|
||||
label="&zotero.preferences.openAboutMemory;"
|
||||
oncommand="Zotero_Preferences.openInViewer('about:memory')"/>
|
||||
<button id="db-info"
|
||||
label="DB Info"
|
||||
oncommand="Zotero.DB.info().then(json => Zotero.alert(null, '', JSON.stringify(json, null, 4)))"/>
|
||||
<button id="vacuum"
|
||||
label="Vacuum DB"
|
||||
oncommand="Zotero.DB.vacuum().then(() => Zotero.alert(null, '', 'Done'))"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</overlay>
|
||||
|
|
|
@ -42,7 +42,6 @@ Zotero.DBConnection = function(dbName) {
|
|||
|
||||
this.closed = false;
|
||||
this.skipBackup = false;
|
||||
this.transactionVacuum = false;
|
||||
|
||||
// JS Date
|
||||
this.__defineGetter__('transactionDate', function () {
|
||||
|
@ -500,6 +499,8 @@ Zotero.DBConnection.prototype.executeTransaction = Zotero.Promise.coroutine(func
|
|||
if (options.vacuumOnCommit) {
|
||||
Zotero.debug('Vacuuming database');
|
||||
yield this.queryAsync('VACUUM');
|
||||
Zotero.debug('Done vacuuming');
|
||||
|
||||
}
|
||||
|
||||
this._transactionID = null;
|
||||
|
@ -868,6 +869,23 @@ Zotero.DBConnection.prototype.observe = function(subject, topic, data) {
|
|||
}
|
||||
|
||||
|
||||
// TEMP
|
||||
Zotero.DBConnection.prototype.vacuum = function () {
|
||||
return this.executeTransaction(function* () {}, { vacuumOnCommit: true });
|
||||
};
|
||||
|
||||
|
||||
// TEMP
|
||||
Zotero.DBConnection.prototype.info = Zotero.Promise.coroutine(function* () {
|
||||
var info = {};
|
||||
var pragmas = ['auto_vacuum', 'cache_size', 'locking_mode', 'page_size'];
|
||||
for (let p of pragmas) {
|
||||
info[p] = yield Zotero.DB.valueQueryAsync(`PRAGMA ${p}`);
|
||||
}
|
||||
return info;
|
||||
});
|
||||
|
||||
|
||||
Zotero.DBConnection.prototype.integrityCheck = Zotero.Promise.coroutine(function* () {
|
||||
var ok = yield this.valueQueryAsync("PRAGMA integrity_check");
|
||||
return ok == 'ok';
|
||||
|
|
Loading…
Reference in New Issue
Block a user