This commit is contained in:
askeluv
2019-03-11 14:33:17 +08:00
parent 8d1b27d130
commit b88e42a52d
6 changed files with 3783 additions and 3769 deletions

View File

@@ -5,7 +5,12 @@ import { logUtils } from '@0x/utils';
import { GithubSource } from '../data_sources/github';
import { GithubFork, GithubPullRequest, GithubRepo } from '../entities';
import * as ormConfig from '../ormconfig';
import { enrichGithubForkWithComparisonDetails, parseGithubForks, parseGithubPulls, parseGithubRepo } from '../parsers/github';
import {
enrichGithubForkWithComparisonDetails,
parseGithubForks,
parseGithubPulls,
parseGithubRepo,
} from '../parsers/github';
import { handleError } from '../utils';
const GITHUB_OWNER = '0xProject';
@@ -55,11 +60,13 @@ let connection: Connection;
const rawForks = await githubSource.getGithubForksAsync(page);
const forks = parseGithubForks(rawForks, observedTimestamp);
logUtils.log('Fetching compare stats for each fork from API.');
const enrichedForks = await Promise.all(forks.map( async fork => {
const comparison = await githubSource.getGithubComparisonAsync(fork.ownerLogin, fork.defaultBranch);
const enriched = enrichGithubForkWithComparisonDetails(fork, comparison);
return enriched;
}));
const enrichedForks = await Promise.all(
forks.map(async fork => {
const comparison = await githubSource.getGithubComparisonAsync(fork.ownerLogin, fork.defaultBranch);
const enriched = enrichGithubForkWithComparisonDetails(fork, comparison);
return enriched;
}),
);
numberOfRecords = enrichedForks.length;
page++;
logUtils.log(`Saving ${enrichedForks.length} forks to database.`);