gitlab-letsencrypt icon indicating copy to clipboard operation
gitlab-letsencrypt copied to clipboard

make polling try every 30s for 15m

Open eedrah opened this issue 6 years ago • 1 comments

I thought the graceful back-down times code was really clever - to double the time to poll for the challenge. I'm definitely going to use the method in other places.

Unfortunately, it doesn't quite 'click' here - to double it and retry 9 times, making 10 attempts in total, means that the biggest gap you can have is the last one - 256 minutes waiting. If all fail, then you've spent 511.5 minutes waiting, around 8.5 hours. On GitLab.com's free tier, that's over 1/4 of the allocated minutes you have per month, meaning that if the process fails 4 times, you've already destroyed all your allowed build time for the next month, for all of your projects, not just this one.

Further, there are reports online that the nonces might even expire after around 10 minutes (although I haven't looked into this nor am I an expert). Which means even after 8 hours of build time, if the challenge finally uploaded, it wouldn't even work.

One thing we do know is that polling is cheap - it's just a basic http request so we don't need to worry about doing it too much.

This pull request addresses the above issues by doing the polling every 30s for 15 minutes, and then stopping. 15 minutes was chosen because it was a little more than the reported 10 minute expiry of the nonce, and I feel that if a site has longer than a 15 minute build time, there is probably a whole lot more going on there that they probably aren't hosting it on GitLab's free pages, but writing their own methods in-house.

eedrah avatar Dec 03 '18 01:12 eedrah

Extremely useful - I ended up forking the repo just to include this PR for my own work immediately, as I'm using this on half a dozen Jekyll sites and the other problem I get are timeouts with regards to the nonces. Would be awesome if this was in the official codebase, or perhaps allowed to be specified on the command line? Thanks @eedrah! (and thanks @rolodato for the great work on the original script)

feralresearch avatar Jan 01 '19 22:01 feralresearch