Tornado was blocked for more than 1 second in
Hi,
I am always getting this exception and anyone has any idea on this.
" Tornado was blocked for more than 1 second in"
That exact message ("Tornado was blocked for more than 1 second") doesn't appear in Tornado, although it's similar to the message we had for set_blocking_log_threshold (and we now have through asyncio's debug mode). Are you installing some third-party debugging tool?
Anyway, what this message is telling you is that what you're doing here (loading something from a database?) is taking more than 1 second and that will cause poor performance in a non-blocking concurrency model like Tornado's. If you're not expecting the object load to take more than a second, fix that first. But if it's plausible for this to take a long time, you should run it in a thread pool with something like asyncio.to_thread() (note that this requires python 3.9. There are less-concise equivalents in older Python versions. Python 3.7 and Tornado 4.5 are no longer supported)