Problem with changing static context location

#1
Hi. I'd like to ask a question about a problem that I've been facing with OpenLiteSpeed.

Here's the full problem.

So I'm running a deployment script on my VM. When there's new version of the app, the scripts runs this sequence:
  1. Create a backup folder for the current production web folder.
  2. Create (or if exists, edit) context for URL "/" to point to the backup folder.
  3. Restart OLS using `service lsws try-restart`.
  4. Wait for 5s so I'm sure OLS fully restarts.
  5. Delete current production web folder.
  6. Copy new files to the production web folder.
  7. Edit context for URL "/" to point to the new production web folder with the new files.
  8. Restart OLS using `service lsws try-restart`.
  9. Wait for 5s so I'm sure OLS fully restarts.
  10. Delete backup folder.
When the script is running I monitor the web by continuously sending request to URL "/".

Now, the problem happens at step 5 and 10. When the production or backup web folder is deleted, there's about 1-2 seconds window the webserver returns 404, and then goes back to normal. Even though at that point OLS should use the new folder (I checked at the WebAdmin, and I swear it showed that the context uses the new folder), instead of the previous one that gets deleted.

What is the solution for this?

Thank you.
 
Top