I think it’s important to step back and think about the bigger picture…websites generally don’t have a pattern where you wait for an hour for something to happen. So yes, Streamlit does functionally have a timeout (probably 10-15 minutes before the websocket is closed, not sure exactly), but at the same time your app sounds more like something that should be as a cron script/data pipeline.
Of course, if Python is actually doing something reasonably webapp-ish, then you shouldn’t really have timeout issues.
Yeah, i should reconsider how I gather the data. I work with the pytchat module that helps you collecting livestream comments without selenium and beautifulsoup and it needs a longer connection to gather the data.
After around 15 mins the running animation in the top right corner stops. That fits with your explanation.
Hi @randyzwitch, @MaxMnemodo you know if there is a way to extend that timeout - to let’s say 30 mins? The processing time of my use case is very close to 10-15 min, and want to avoid any issues. Thanks in advance.
I’m using Streamlit to empower users to run Monte Carlo simulations which take 20-40 mins. Sometimes the processing completes, but the results aren’t displayed. Other times the page just refreshes while the processing continues in the backend.
I’m curious to know if this is recommended. And if not, would it be possible to tweak some settings to work around this?
In the case of 20-40 min long-running processes, I would consider how you can split your code into the Streamlit front-end and a processing backend.
For example, you could move the actual monte carlo simulation to something like FastAPI, so that Streamlit requests a run and then you periodically check to see if the run is complete. It’s slightly more work, but it’s much more “web” like than having a process running 20-40 mins long and hoping nothing happens on the Streamlit frontend.
Hi, thanks for these answers. I’m having a similar issue. I have Streamlit calling my backend function, according to the settings input by each user. Every few minutes it logs something to the Streamlit interface. And then periodically the Streamlit front end resets.
What I don’t understand is: If I moved my backend to FastAPI, and Streamlit resets, how would Streamlit check to see if the run is complete? There could be multiple instances running and I can’t figure out how to know which run this browser window was talking to.