Refactor sync._sync as an async function
This stuff is much more clearly expressed as an async function than as a
promise chain, and I'm about to add more stuff to the chain, so let's refactor
now.
There is plenty more that could be done here (self -> this, for instance), but
I've gone for keeping the diff minimal.