It's not clear from reading this function what state the spa is left in once it finishes (eg is it completely sync, or could other stuff still be completing).  Suggest documenting the what state the spa is or isn't guaranteed to be in once this function returns.