File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -274,14 +274,21 @@ export interface ProblemRankData {
274274}
275275
276276export const getProblemRankData = async ( ) : Promise < ProblemRankData [ ] > => {
277- const data = await Promise . race ( [
278- fetch (
279- 'https://cdn.jsdelivr.net/gh/zerotrac/leetcode_problem_rating/data.json'
280- ) . then ( res => res . json ( ) ) ,
281- fetch (
282- 'https://raw.githubusercontent.com/zerotrac/leetcode_problem_rating/main/data.json'
283- ) . then ( res => res . json ( ) ) ,
284- ] )
277+ const dataUrls = [
278+ 'https://raw.githubusercontent.com/zerotrac/leetcode_problem_rating/main/data.json' ,
279+ 'https://cdn.jsdelivr.net/gh/zerotrac/leetcode_problem_rating/data.json' ,
280+ 'https://testingcf.jsdelivr.net/gh/zerotrac/leetcode_problem_rating/data.json' ,
281+ 'https://fastly.jsdelivr.net/gh/zerotrac/leetcode_problem_rating/data.json' ,
282+ 'https://gcore.jsdelivr.net/gh/zerotrac/leetcode_problem_rating/data.json' ,
283+ ]
284+ const data = await Promise . race (
285+ dataUrls . map ( url =>
286+ fetch ( url , { headers : { } } )
287+ . then ( res => res . json ( ) )
288+ . catch ( ( ) => new Promise ( ( res , rej ) => setTimeout ( rej , 10000 ) ) )
289+ )
290+ )
291+
285292 return data
286293}
287294
You can’t perform that action at this time.
0 commit comments