search: Ignore search provider results metas if search is cancelled

When a search has been cancelled, it is expected that providers don't
return the requested number of results, so don't log a warning in that
case.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/205
This commit is contained in:
Marco Trevisan (Treviño) 2018-08-30 07:11:24 +02:00 committed by Florian Müllner
parent da7cd2807f
commit b72b773d87

View File

@ -226,6 +226,12 @@ var SearchResultsBase = new Lang.Class({
this._cancellable.reset(); this._cancellable.reset();
this.provider.getResultMetas(metasNeeded, metas => { this.provider.getResultMetas(metasNeeded, metas => {
if (this._cancellable.is_cancelled()) {
if (metas.length > 0)
log(`Search provider ${this.provider.id} returned results after the request was canceled`);
callback(false);
return;
}
if (metas.length != metasNeeded.length) { if (metas.length != metasNeeded.length) {
log('Wrong number of result metas returned by search provider ' + this.provider.id + log('Wrong number of result metas returned by search provider ' + this.provider.id +
': expected ' + metasNeeded.length + ' but got ' + metas.length); ': expected ' + metasNeeded.length + ' but got ' + metas.length);