python - Place a timeout on calls to an unresponsive Flask route -


i have route in flask app pulls data external server , pushes results front end. external server slow or unresponsive. what's best way place timeout on route call, front end doesn't hang if external server lagging? or there more appropriate way handle situation in flask (not apache, nginx, etc)?

update: goal timeout route call, not keep arbitrary long process alive question: time out issues chrome , flask. options websockets run background processes/threads until finish; however, want stop slow route call after fixed amount of time has elapsed. timeout on function call , python timeout within flask context. celery's task decorator (concurrent asynchronous processes python, flask , celery) seems great solution, don't want require large dependency use small amount of functionality.

i reopened question here: place timeout on calls unresponsive flask route (updated).


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -