Fix a race condition for asynchronously processing a collection.