Skip to content

Commit 5af5b69

Browse files
committed
fix: increase topThreeContributors API rate limit to 30000ms
1 parent 28af89f commit 5af5b69

3 files changed

Lines changed: 3 additions & 5 deletions

File tree

components/index/TopThreeContributors.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const TopThreeContributors: FC = () => {
2424

2525
try {
2626
const response = await axios.get('/api/topThreeUsers', {
27-
timeout: 8000
27+
timeout: 30000
2828
});
2929

30-
// Log debug messages from headers
3130
for (let i = 1; i <= 5; i++) {
3231
const message = response.headers[`x-debug-message${i ? '-' + i : ''}`];
3332
if (message) {
@@ -39,7 +38,7 @@ const TopThreeContributors: FC = () => {
3938
const fetchedData = response.data;
4039

4140
if (Array.isArray(fetchedData) && fetchedData.length > 0) {
42-
// Sort the data by contributions in descending order
41+
//* Sort the data by contributions in descending order
4342
const sortedData = [...fetchedData].sort((a, b) => b.contributions - a.contributions);
4443

4544
const mappedData: Contributor[] = sortedData
@@ -145,3 +144,4 @@ export { TopThreeContributors }
145144

146145

147146

147+

pages/api/topThreeUsers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
import { fetchTopThreeUsersByPullRequests } from "../../utils/fetchTopThreeUsersByPullRequests";
66

77
export default async (req, res) => {
8-
// Set CORS headers
98
res.setHeader('Access-Control-Allow-Origin', '*');
109
res.setHeader('Access-Control-Allow-Methods', 'GET');
1110
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');

utils/fetchTopThreeUsersByPullRequests.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export async function fetchTopThreeUsersByPullRequests(repoPath: string) {
2828
}
2929
});
3030

31-
// Handle pagination
3231
const linkHeader = response.headers.link;
3332
const nextLink = linkHeader
3433
? linkHeader.split(",").find((s: string) => s.includes('rel="next"'))

0 commit comments

Comments
 (0)