Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion config/cdConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const crawlerStoreProvider = config.get('CRAWLER_STORE_PROVIDER') || 'cd(file)'
const maxRequeueAttemptCount = config.get('CRAWLER_MAX_REQUEUE_ATTEMPTS') || 5
const fetchedCacheTtlSeconds = config.get('CRAWLER_FETCHED_CACHE_TTL_SECONDS') || 60 * 60 * 8 //8 hours

function getLicenseeParallelism() {
const num = Number(config.get('CRAWLER_LICENSEE_PARALLELISM') || process.env.CRAWLER_LICENSEE_PARALLELISM)
return num > 0 ? num : 10;
}

module.exports = {
provider: 'memory', // change this to redis if/when we want distributed config
searchPath: [module],
Expand Down Expand Up @@ -67,7 +72,9 @@ module.exports = {
},
gem: { githubToken },
go: { githubToken },
licensee: {},
licensee: {
processes: getLicenseeParallelism()
},
maven: { githubToken },
npm: { githubToken },
nuget: { githubToken },
Expand Down
3 changes: 2 additions & 1 deletion providers/process/licensee.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class LicenseeProcessor extends AbstractProcessor {
const root = request.document.location
const subfolders = await this.getFolders(root, ['/.git'])
const paths = ['', ...trimAllParents(subfolders, root)]
const { processes } = this.options
try {
const results = (
await Promise.all(paths.map(throat(10, path => this._runOnFolder(path, root, parameters))))
await Promise.all(paths.map(throat(processes, path => this._runOnFolder(path, root, parameters))))
).filter(x => x)
const licenses = uniqBy(flatten(results.map(result => result.licenses)), 'spdx_id')
const matched_files = flatten(results.map(result => result.matched_files))
Expand Down