Database thread should actually have an exit condition.