NEXUS-5472: Fixed a NPE and improvements

NPE sneaked in during last refactoring, and fixed how
updated repository publishing happens. Before, it was marked
noscrape during update, but now old prefix file remains
reachable during update, and depending on outcome it's updated
or removed (and repo marked for noscrape).
Also, the bg task made more robust and will log any
problem it encounters