Skip to content

Commit

Permalink
take glob-match off the critical path when adding a new model, micros…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Apr 21, 2016
1 parent 85e0271 commit a6bbbf5
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,25 @@ export class ExtensionTipsService implements IExtensionTipsService {
return;
}

forEach(this._availableRecommendations, entry => {
let {key: pattern, value: ids} = entry;
if (match(pattern, uri.fsPath)) {
for (let id of ids) {
this._recommendations[id] = true;
// re-schedule this bit of the operation to be off
// the critical path - in case glob-match is slow
setImmediate(() => {

forEach(this._availableRecommendations, entry => {
let {key: pattern, value: ids} = entry;
if (match(pattern, uri.fsPath)) {
for (let id of ids) {
this._recommendations[id] = true;
}
}
}
});
});

this._storageService.store(
'extensionsAssistant/recommendations',
JSON.stringify(Object.keys(this._recommendations)),
StorageScope.GLOBAL
);
this._storageService.store(
'extensionsAssistant/recommendations',
JSON.stringify(Object.keys(this._recommendations)),
StorageScope.GLOBAL
);
});
}

dispose() {
Expand Down

0 comments on commit a6bbbf5

Please sign in to comment.