for await is only useful if the iterable object is an async iterable, which Object.values(typeIndexMap) is not. As the actual promise is typeIndexConfig.index.deleteObjects(recordsToDelete), that meant that execution would resume no matter if that operation was completed (or threw an error) or not. This PR fixes this by awaiting the actual promise.
for await
is only useful if the iterable object is an async iterable, whichObject.values(typeIndexMap)
is not. As the actual promise istypeIndexConfig.index.deleteObjects(recordsToDelete)
, that meant that execution would resume no matter if that operation was completed (or threw an error) or not. This PR fixes this by awaiting the actual promise.