Duration is not returned before build is finished