mdgspace / codephile-backend

Back-end for Official Codephile App
https://codephile.mdg.iitr.ac.in/
16 stars 6 forks source link

Don't retry codeforces submission fetching if handle is incorrect #167

Open prateek2211 opened 4 years ago

prateek2211 commented 4 years ago

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

Arnesh07 commented 4 years ago

@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

dev-ritik commented 4 years ago

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

prateek2211 commented 4 years ago

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

dev-ritik commented 4 years ago

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.

Arnesh07 commented 4 years ago

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

prateek2211 commented 4 years ago

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

prateek2211 commented 3 years ago

@Arnesh07 Is this issue resolved?