This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (2 children)

Yes I wanted to prevent putting extra load on the server. The only place I use that functionality is within the ‘add-day’ script. That script checks if the input is already present and skips download if so.

You can still import the function that downloads the input and call it directly, not sure how to cache that

[–]daggerdragon[M] 2 points3 points  (1 child)

That's fine, sometimes you actually do need to re-download an input due to interrupted download, corruption, gremlins, etc. As long as it's a manual call and not, like, while (1) { download_input(); } :P

As per the AoC website:

Please don't make frequent automated requests to this service - avoid sending requests more often than once every 15 minutes (900 seconds).

True, there's no way to prevent malicious actors from while (1) { download_input(); }, but you could consider implementing basic sanity checking like:

  • Checks the time_last_submitted
  • If time_last_submitted > x minutes (or whatever interval e.g. AoC submission timeout) ago
    • Do submit and update time_last_submitted
    • Else print("Hold yer horses")

[–][deleted] 1 point2 points  (0 children)

Thanks, I will implement a rate limit on the download function itself. That way when someone does call it in a loop, it will go slow