A second task was able to finish a first task without the first tasks quantity reaching 0, in which case the state of the first task went from PROCESSED to READY and would never finish. Cherry picked from fdc1991c32cfc6ba4ef735641dbe8f593f745486
A second task was able to finish a first task without the first tasks quantity reaching 0, in which case the state of the first task went from PROCESSED to READY and would never finish. Cherry picked from fdc1991c32cfc6ba4ef735641dbe8f593f745486