Skip to content

Commit

Permalink
Skohub: Do not use scheme.concepts as concept cache (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Jun 21, 2022
1 parent d80342e commit ef22dc9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/providers/skohub-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class SkohubProvider extends BaseProvider {

_setup() {
this._jskos.schemes = this.schemes || []
this._cache = {}
}

async getSchemes({ ...config }) {
Expand Down Expand Up @@ -129,23 +130,21 @@ export default class SkohubProvider extends BaseProvider {
continue
}

const found = scheme.concepts.find(c => (c && c.uri === uri))

const found = this._cache[uri]
if (found) {
newConcepts.push(found)
} else if (_.last(scheme.concepts) === null) {
try {
const loaded = await this._loadConcept(uri)
if (loaded) {
newConcepts.push(loaded)
scheme.concepts = [loaded].concat(scheme.concepts)
this._cache[loaded.uri] = loaded
}
} catch (error) {
// Ignore error
}
}
}

return newConcepts
}

Expand Down

0 comments on commit ef22dc9

Please sign in to comment.