Issue #3417119 by apotek, markdorison: Better handling of potential race conditions between deletion queue and migration queue