chaha0s
chaha0s

Reputation: 128

How can I push an update on GitHub pages while people are browsing the site?

I've a site on GitHub pages. I've made some changes and need to push it to the master. But there are people active on the website. What will happen if I push it? Will they see some error if I don't remove existing resources but edit them?

Upvotes: 0

Views: 41

Answers (1)

bk2204
bk2204

Reputation: 76509

GitHub Pages works by building your site and then at some point performing an update to refer to the new copy rather than the old one, and then expiring the cache for your site. Note that the user's browser also has caching involved.

If you want to be sure that your site continues to work if someone refreshes the page, you'll need to make sure that either your new resources are backwards compatible with the old version or to generate resources with a unique file name (such as a hash of the contents on the end) and upload those. I'm not sure if the latter option is available in the standard Jekyll template and allowed plugins, so it probably would only work if you were uploading a non-Jekyll site.

Overall, it's unlikely that folks are going to see a problem, because in order for things to be broken, someone would have to load the old web page and then load the new resources exactly at that point at which the cache was flushed. Consequently, this race condition is probably small enough for most small sites that it isn't worrying about. It's only when you get to much larger sites, like GitHub itself, that this becomes a problem.

Upvotes: 1

Related Questions