I know what’s happening, you actually deleted a device.
Except that currently in Gladys, when you delete a device, it will delete in cascade all the device_features as well as the states of these features ![]()
You understood, if behind this device there are thousands of states, it can take 2 minutes and during this time, the DB is blocked because it’s a huge transaction that takes all the disk bandwidth.
We thought of a solution if this problem becomes too recurrent, it would be to delete the states in a softer way, spreading their deletion over time (200 by 200 for example), to let the Gladys instance breathe between these deletions.
After that, it’s a development in its own right
You can create a github issue so we can keep track of it? I can’t guarantee that I will work on it in the coming days, but you’re right it’s an important point ![]()