Fix: race condition on task status updating