Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with commits #2358

Closed
vsoch opened this issue Dec 30, 2022 · 7 comments
Closed

Bug with commits #2358

vsoch opened this issue Dec 30, 2022 · 7 comments
Labels
bug Something isn't working.

Comments

@vsoch
Copy link

vsoch commented Dec 30, 2022

Describe the bug

There seems to be a bug with commits. My (previously S+) chart is now A++ and it only shows 500 commits?

image

I have over 5K.

Expected behaviour

I have over 5K commits. I wouldn't expect the rating the drop this quickly, and I wouldn't expect the chart to report only 150 or so.

image

Screenshots / Live demo link

https://github.com/vsoch/

and

https://camo.githubusercontent.com/f044fdd12c5db5f147b99799ff57ebd2cdf2438b7ffa1be653a07bc00eeb0b7c/68747470733a2f2f6769746875622d726561646d652d73746174732e76657263656c2e6170702f6170693f757365726e616d653d76736f63682673686f775f69636f6e733d7472756526636f756e745f707269766174653d7472756526696e636c7564655f616c6c5f636f6d6d6974733d74727565267468656d653d7472616e73706172656e74

Additional context

No response

@vsoch vsoch added the bug Something isn't working. label Dec 30, 2022
@bylickilabs
Copy link

bylickilabs commented Dec 30, 2022

@vsoch

Hello, It may take some time before the stats are adjusted. Usually every full hour +/-
I think a real-time synchronization cannot be guaranteed, as this would affect the resources as many Gitler actively use it! Including me...

@vsoch
Copy link
Author

vsoch commented Dec 30, 2022

Why would the commits drop down to 150? That seems like a bug.

@bylickilabs
Copy link

@vsoch
This is definitely a mistake, but it can happen! My stats graphs currently show 84.8K Total Stars. That's not right either! I am under 130 stars. I would wait and read the statistics again if necessary. Will do the same tomorrow at the latest if it doesn't update. Regards

@vsoch
Copy link
Author

vsoch commented Dec 31, 2022

okay, must be a bug - will circle back tomorrow. Thanks for the speedy response!

@rickstaa
Copy link
Collaborator

rickstaa commented Jan 3, 2023

okay, must be a bug - will circle back tomorrow. Thanks for the speedy response!

@vsoch @bylickilabs is right. We in rare cases get the wrong information from the GraphQL API. This is mostly resolved when the cache is renewed.

@rickstaa rickstaa closed this as completed Jan 3, 2023
@vsoch
Copy link
Author

vsoch commented Mar 9, 2023

Just wanted to post again - the metrics I think are wrong again today?

image

@rickstaa
Copy link
Collaborator

rickstaa commented Mar 9, 2023

Just wanted to post again - the metrics I think are wrong again today?

image

Thanks! Now we know what is going on (see #1515). This happens when the GitHub rest API fails. In that case, 0 is returned, and the private contributions are displayed:

const totalCommitsFetcher = async (username) => {
if (!githubUsernameRegex.test(username)) {
logger.log("Invalid username");
return 0;
}
// https://developer.github.com/v3/search/#search-commits
const fetchTotalCommits = (variables, token) => {
return axios({
method: "get",
url: `https://api.github.com/search/commits?q=author:${variables.login}`,
headers: {
"Content-Type": "application/json",
Accept: "application/vnd.github.cloak-preview",
Authorization: `token ${token}`,
},
});
};
try {
let res = await retryer(fetchTotalCommits, { login: username });
let total_count = res.data.total_count;
if (!!total_count && !isNaN(total_count)) {
return res.data.total_count;
}
} catch (err) {
logger.log(err);
}
// just return 0 if there is something wrong so that
// we don't break the whole app
return 0;
};

if (count_private) {
stats.totalCommits +=
user.contributionsCollection.restrictedContributionsCount;
}

There is a draft open that might solve the issues you are having. See #2448 (comment). Feel free to complete it if you want 👍🏻.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

3 participants