and can theoretically result in a migration that never ends.
The issue is caused by yielding here:
Here, we break early and if the iterator didn't move then the erase here:
will end up erasing nothing. A potential fix is to move the yield check at top to make sure that the iterator is not equal to the begin iterator when the command added a document to the response buffer (with a check that it is not equal to the begin iterator, otherwise, we can end up with a different problem of not returning any document).