Prevent eternal looping when db is locked.