05c75e8c8d
We currently close the database as soon as possible while we handle the status backend but this is still too early because autorefresh induces looping on this code block. Instead of delaying the closing outside of the loop, it's easier to delay the opening as late as possible (inside the loop). The downside is that the database is opened/closed more than once when autorefresh is enabled. The good news is that this make the code much easier. Fixes regression introduces by 6fb5700. Reported-by: Łukasz Żarnowiecki <dolohow@outlook.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>