mirror of
https://github.com/zotero/zotero.git
synced 2026-10-13 03:58:05 +00:00
Don't open a DB transaction when plugins register or refresh UI elements
The transaction didn't do any database work, but sync and other transactions had to wait for it to finish, so an observer that never returned could leave startup sync stuck at "Waiting for other operations to finish". https://forums.zotero.org/discussion/134185/
This commit is contained in:
parent
44fe83d98b
commit
3378fc94f0
1 changed files with 10 additions and 8 deletions
|
|
@ -327,14 +327,16 @@ class PluginAPIBase {
|
|||
return;
|
||||
}
|
||||
this._lastUpdateID = this._generateRandomKey();
|
||||
await lazy.Zotero.DB.executeTransaction(async () => {
|
||||
lazy.Zotero.Notifier.queue(
|
||||
this._config.notifyAction,
|
||||
this._config.notifyType,
|
||||
ids,
|
||||
extraData,
|
||||
);
|
||||
});
|
||||
// register(), unregister(), and refresh() call _refresh() without awaiting it, so yield
|
||||
// first to keep observers -- and the plugin hooks they call -- from running before those
|
||||
// calls return
|
||||
await Promise.resolve();
|
||||
await lazy.Zotero.Notifier.trigger(
|
||||
this._config.notifyAction,
|
||||
this._config.notifyType,
|
||||
ids,
|
||||
extraData,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue