Skip to content

Commit

Permalink
Fix to not duplicate package send to live-resolver (OctoLinker#531)
Browse files Browse the repository at this point in the history
I did a stupid mistake in the previous implementation. For every URL within a resolve item it was duplicating the resolves items wich caused N+1 requests for every package. Luckily it was just sending two request for each package
  • Loading branch information
stefanbuck authored Dec 18, 2018
1 parent 2963ac8 commit 8a78645
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ async function runLiveQuery(matches) {
createStore(json, payload);
}

function matchContainsOnlyRegistyMatches(match) {
return match.urls.every(url => url.type === 'registry');
}

function filterLiveResolver(matches) {
return matches.reduce((memo, match) => {
match.urls.forEach(url => {
if (url.type !== 'registry') {
return;
}

if (matchContainsOnlyRegistyMatches(match)) {
memo.push(match);
});
}

return memo;
}, []);
Expand Down

0 comments on commit 8a78645

Please sign in to comment.