Say I have a website with 2 files, which are statically hosted on S3:
index.html
script.js
I have a scheme where these files are updated via a git pull
from a remote origin every time I push. This got me thinking, though, that there's the possibility for a request to be made to the server as a git pull
is happening to update the files. This seems like it could create two problems that would cause page errors:
- A partially-updated
index.html
orscript.js
is returned. - An old
index.html
is returned to the client. The files are then updated on the server. The client then makes a request forscript.js
, which returns the new version.
What is a good practice for mitigating these two issues?
I imagine the first issue won't be a problem, assuming filesystem operations are atomic and the files are updated in a single go. However, I haven't seen anything that addresses the second issue, which seems more difficult to address.
Aucun commentaire:
Enregistrer un commentaire