Limit concurrency of a function returning a promise.