Waits for db availability since state switching is async nowadays