xalanq / cf-tool

:bar_chart: Codeforces CLI (Submit, Parse, Test, etc.). Support Contests, Gym, Groups, acmsguru, Windows, macOS, Linux, 7 MB
MIT License
1.31k stars 227 forks source link

Handle delay in contest, properly #101

Open etanot opened 4 years ago

etanot commented 4 years ago

Yesterday, Educational Round #87 delayed twice times by 10 then 5 minutes; I got this error message twice times, Cannot find any problem statis.

$ cf race 1354
Race CONTEST 1354
Countdown: 
Open https://codeforces.com/contest/1354
Open https://codeforces.com/contest/1354/problems
Parse CONTEST 1354
Cannot find any problem statis
$ cf race 1354
Race CONTEST 1354
Countdown: 
^C:05:29

I know this happened because cf-tool wasn't able to parse question, but isn't it a good idea to handle this case by checking whether contest has delayed? If yes, show proper message like "Contest has been delayed by 10 minutes" or something similar rather than showing above error message.

infalmo commented 4 years ago

Actually, what happens is, once countdown has been parsed from the site, countdown is run offline. This is ideally better than parsing the countdown every second from the site. In case of contest extensions, you'll have to break from the contest timer and restart the timer.

This is because countdown is fetched from a different page than the problems page

etanot commented 4 years ago

countdown is fetched from a different page than the problems page

Isn't it a good idea to recheck countdown page, again when we encounter above error?

the-redback commented 4 years ago

It will be better to recheck the time every 25 seconds. This way users won't reach the rate limit and at the same time, the countdown will be almost synced!