codephile-backend icon indicating copy to clipboard operation
codephile-backend copied to clipboard

Don't retry codeforces submission fetching if handle is incorrect

Open prateek2211 opened this issue 5 years ago • 7 comments

Currently if the codeforces API gives status which is not "OK", then it retries, assuming that max API limit is exceeded. But status could be not "OK", even if handle is invalid.

https://github.com/mdg-iitr/Codephile/blob/d6bcea4f3e5c2417420e37822c61ca8c0e06c4c8/scrappers/codeforces/scrapper.go#L60

Try this: http://codeforces.com/api/user.status?handle=incorrect-handle&from=500&count=50

prateek2211 avatar Jun 14 '20 06:06 prateek2211

@prateek2211 shouldn't we verify the handle first before fetching the submissions?

Handle verification takes quite significant time. Verifying it everytime we fetch submissions would be too much overkill

Arnesh07 avatar Jun 21 '20 08:06 Arnesh07

Are the response status code for max API limit is exceeded and handle is invalid the same?

dev-ritik avatar Jun 21 '20 09:06 dev-ritik

the status is "failed" in both the cases but the comment is different. Currently we use status to check for api limit, better would be to also add a check on comment

prateek2211 avatar Jun 21 '20 10:06 prateek2211

And what about the HTTP status code? I believe they will be different. Rather than matching for the comment, it would be better to check for status code in this case.

dev-ritik avatar Jun 21 '20 11:06 dev-ritik

@prateek2211 Iss error ka response code toh 400 hai, do you know dusre waale ka kya hai?

Arnesh07 avatar Jun 21 '20 11:06 Arnesh07

I don't really remember it, you could write a loop and cross the limit to see the status code

prateek2211 avatar Jun 21 '20 11:06 prateek2211

@Arnesh07 Is this issue resolved?

prateek2211 avatar Apr 25 '21 14:04 prateek2211