I'm currently writing my own API and due to the other site limitation, I have to update my json database periodically. I came up with an idea to create an endpoint which will update it and call this endpoint with another script running 24/7. My API also do the search function and from what I know, I need to ensure that my collection won't be changed during search call. How to check if every call is ended and my data can be safely changed? Or is there any other way to overcome this?