Deployed plotly dash not updating

For my deployed servers, I like using flask-mail to send me the traceback.format_exc on errors.

It looks like a timeout limit, so it runs for 30seconds and then stops.

Are there a way to change that behaviour ?

The worker starts for 30 seconds and then stops? Sounds like something isn’t quite right with connecting to your mongodb.

it seems that way. It runs about 3/4 of the code and then just stops with the following message:

I found this article but I do not understand it really:

Try this:

def refresh_data(value):
    #global df_AS
    try:
        client = MongoClient()
    
        #point the client at mongo URI
        client = MongoClient('mongodb+srv://xxxxxxx.530fwyt.mongodb.net')
        #select database
        db = client['test']
        #select the collection within the database
        #df_AS = db.newassets
        df_AS = pd.DataFrame(list(db.newassets.find()))
        client.close()
        return df_AS.to_dict('records')
    except:
        return pd.DataFrame({'Branch_Allocation':['error connecting to MongoDB'],
                             'Date':[],
                             'GL_Account_Accumalative_Depreciation':[traceback.format_exc()]})

This should give you the print out of what is happening when trying to connect with your MongoDB.

Not sure how you deployed things, but I think NGINX and UWSGI (and likely other web servers) have default timeout limits that you might need to configure. The 30 seconds that you mention makes me think that that would be the primary issue, especially if the same code is able to fetch information from the database outside of the web app context. See this for an example and might need to look around for your specific web server gateway for a similar timeout parameter: uWSGI request timeout in Python - Stack Overflow.

Hi @EhanGreens133 , were you able to find a solution for your problem ? I am having the exact same issue with my deployed Dash app.

Hey guys, just FYI you can increase timeout limit in render by editing your Start Command i.e.:

gunicorn app:server --timeout 600

Do it with caution, in this case when something goes wrong the app will be frozen for 10 minutes. I know I have one heavy computation on my app which can take long so I increased the limit with this command.