Fix race condition in HttpRemoteTask

There is a race condition in HttpRemoteTask where it can race on setting the value of the needsUpdate flag. The potential result of this is that we can silently drop a failed HTTP request and not notify any of the callers.