Show data in real time connected on MySQL

Hi !
Im working on a project that needs to show data every 6sec from database mysql while every data comes each 5sec in a database mysql for now all in a local computer space,
Using a multipage page model I’ve also tried multi ways to reload the page since the data don’t detect the changes in the databases an exemple is :

# run the app function
        if page['title'] == "Live Data":
            count = 0
            while True:
                count += 1
                if count == 5:
                    count = 0

But Streamlit shows only running in the top left of the screen and stops to work correctly.
I’ve looked also tru all topics of forum or stackoverflow but nothing seems to answer this need.
I didn’t add a state section either a cache cuz I don’t understand it clearly and I don’t think its appropriate for this issue.

Would raccomand anything to solve this ?

Thanks for those who will read and take time to respond .

I’m currently using a time.sleep() followed by st.experimental_rerun() and actually it does a good job