Ensure that the totalLength is a promise