File tree Expand file tree Collapse file tree 1 file changed +19
-20
lines changed Expand file tree Collapse file tree 1 file changed +19
-20
lines changed Original file line number Diff line number Diff line change @@ -122,28 +122,27 @@ async def is_cn_contest_data_ready(
122122 )
123123 )[0 ].json ()
124124 fallback_local = cn_data .get ("fallback_local" )
125- if fallback_local is None :
126- us_data = (
127- await multi_http_request (
128- {
129- "req" : {
130- "url" : f"https://leetcode.com/contest/api/ranking/{ contest_name } /" ,
131- "method" : "GET" ,
132- }
133- }
134- )
135- )[0 ].json ()
136- # check user_num in two different regions, if they are equal then return True
137- is_satisfied = (cn_user_num := cn_data .get ("user_num" )) >= (
138- us_user_num := us_data .get ("user_num" )
139- )
140- logger .info (f"check { cn_user_num = } { us_user_num = } { is_satisfied = } " )
141- if is_satisfied :
142- await save_user_num (contest_name )
143- return is_satisfied
144- else :
125+ if fallback_local is not None :
145126 logger .info (f"check { fallback_local = } unsatisfied" )
146127 return False
128+ us_data = (
129+ await multi_http_request (
130+ {
131+ "req" : {
132+ "url" : f"https://leetcode.com/contest/api/ranking/{ contest_name } /" ,
133+ "method" : "GET" ,
134+ }
135+ }
136+ )
137+ )[0 ].json ()
138+ # check user_num in two different regions, if they are equal then return True
139+ is_satisfied = (cn_user_num := cn_data .get ("user_num" )) >= (
140+ us_user_num := us_data .get ("user_num" )
141+ )
142+ logger .info (f"check { cn_user_num = } { us_user_num = } { is_satisfied = } " )
143+ if is_satisfied :
144+ await save_user_num (contest_name )
145+ return is_satisfied
147146 except Exception as e :
148147 logger .error (f"check fallback_local error={ e } " )
149148 return False
You can’t perform that action at this time.
0 commit comments