I asked a similar question the other day
→ Does streamlit has a maximum run time for functions?
The reason for that is that streamlit uses a web socket for your app. This web socket has a maximum run time and stops your functions after around 10-15 mins.