feat(plugins/base): split base queries to reduce GitHub API timeouts (#584)

This commit is contained in:
Simon Lecoq authored and GitHub committed 2021-10-22 00:05:00 -04:00
1 parent f75638d3a0
commit ead8bd2eb7
14 files changed
+223 -170

No files matched your search

@@ -0,0 +1,41 @@
/**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > base/user")
return ({
user:{
calendar:{
contributionCalendar:{
weeks:[
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
],
},
},
},
})
}
@@ -0,0 +1,16 @@
/**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > base/user")
return ({
user:{
contributionsCollection:{
totalRepositoriesWithContributedCommits:faker.datatype.number(100),
totalCommitContributions:faker.datatype.number(10000),
restrictedContributionsCount:faker.datatype.number(10000),
totalIssueContributions:faker.datatype.number(100),
totalPullRequestContributions:faker.datatype.number(1000),
totalPullRequestReviewContributions:faker.datatype.number(1000),
},
},
})
}
@@ -0,0 +1,18 @@
/**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > base/user")
return ({
user:{
packages:{totalCount:faker.datatype.number(10)},
starredRepositories:{totalCount:faker.datatype.number(1000)},
watching:{totalCount:faker.datatype.number(100)},
sponsorshipsAsSponsor:{totalCount:faker.datatype.number(10)},
sponsorshipsAsMaintainer:{totalCount:faker.datatype.number(10)},
repositoriesContributedTo:{totalCount:faker.datatype.number(100)},
followers:{totalCount:faker.datatype.number(1000)},
following:{totalCount:faker.datatype.number(1000)},
issueComments:{totalCount:faker.datatype.number(1000)},
organizations:{totalCount:faker.datatype.number(10)},
},
})
}
@@ -0,0 +1,9 @@
/**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > base/user")
return ({
user:{
repositories:{totalCount:faker.datatype.number(100), totalDiskUsage:faker.datatype.number(100000)},
},
})
}
@@ -11,58 +11,6 @@ export default function({faker, query, login = faker.internet.userName()}) {
websiteUrl:faker.internet.url(),
isHireable:faker.datatype.boolean(),
twitterUsername:login,
repositories:{totalCount:faker.datatype.number(100), totalDiskUsage:faker.datatype.number(100000)},
packages:{totalCount:faker.datatype.number(10)},
starredRepositories:{totalCount:faker.datatype.number(1000)},
watching:{totalCount:faker.datatype.number(100)},
sponsorshipsAsSponsor:{totalCount:faker.datatype.number(10)},
sponsorshipsAsMaintainer:{totalCount:faker.datatype.number(10)},
contributionsCollection:{
totalRepositoriesWithContributedCommits:faker.datatype.number(100),
totalCommitContributions:faker.datatype.number(10000),
restrictedContributionsCount:faker.datatype.number(10000),
totalIssueContributions:faker.datatype.number(100),
totalPullRequestContributions:faker.datatype.number(1000),
totalPullRequestReviewContributions:faker.datatype.number(1000),
},
calendar:{
contributionCalendar:{
weeks:[
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
{
contributionDays:[
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
{color:faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"])},
],
},
],
},
},
repositoriesContributedTo:{totalCount:faker.datatype.number(100)},
followers:{totalCount:faker.datatype.number(1000)},
following:{totalCount:faker.datatype.number(1000)},
issueComments:{totalCount:faker.datatype.number(1000)},
organizations:{totalCount:faker.datatype.number(10)},
},
})
}