Hi Nono,

unfortunately, I'm not an expert in Python development, but it looks like a multithreading approach is the best way to achieve your targets.
If inserting data into the database takes too much time, then probably you should switch to a sort of asynchronous task that will be in charge of only operating on the DB. Otherwise, you risk blocking too often the thread calling the _on_item_update method.
For example, you could enqueue items onto a buffer which will be processed by another thread, whose task is to update the DB.

Best,
Gianluca