sync runs in an infinite loop