optimize when there's no pipe function in promise