File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ const fetchContestRankings = async function (contestSlug) {
2020 // TODO: remove hard coded lines
2121
2222 let pages = Math . floor ( response . user_num / 25 )
23- pages = 2
2423 for ( let i = 1 ; i <= pages ; i ++ ) {
2524 console . log ( "fetching page no.: " + i )
2625 let res = await fetch ( `https://leetcode.com/contest/api/ranking/${ contestSlug } /?pagination=${ i } ®ion=global` ) ;
Original file line number Diff line number Diff line change @@ -26,10 +26,10 @@ const fetchNow = async function(){
2626 let contestList = await fetchContest ( )
2727 if ( ! contestList )
2828 return
29- for ( let i = 0 ; i < contestList . length ; i ++ ) {
30- let endTime = contestList [ i ] . startTime * 1000 + contestList [ i ] . duration * 1000
29+ let promises = contestList . map ( async ( contest ) => {
30+ let endTime = contest . startTime * 1000 + contest . duration * 1000
3131 if ( Date . now ( ) > endTime )
32- await getContestRankings ( contestList [ i ] . titleSlug )
33- }
32+ await getContestRankings ( contest . titleSlug )
33+ } )
3434}
3535exports . fetchAllContests = fetchNow
You can’t perform that action at this time.
0 commit comments