autoupdate icon indicating copy to clipboard operation
autoupdate copied to clipboard

Prioritize PR checks that don't require REST API calls first

Open charlietsai opened this issue 1 year ago • 0 comments

Similar to https://github.com/chinthakagodawita/autoupdate/issues/305, I'm looking into ways to reduce API calls made.

I can see here in prNeedsUpdate: https://github.com/chinthakagodawita/autoupdate/blob/01c66daac498b07a3da617cf375d311d30b877ba/src/autoupdater.ts#L245

that we have this API call this.octokit.rest.repos.compareCommitsWithBasehead relatively early on: https://github.com/chinthakagodawita/autoupdate/blob/01c66daac498b07a3da617cf375d311d30b877ba/src/autoupdater.ts#L263-L272

We don't check for PR_READY_STATE and PR_FILTER until further down, so this API call is made for all PRs that are still open. However, many of these checks would have returned false early on if they were checked first.

I don't think compareCommitsWithBasehead needs to run unless all the conditions pass? Could we change it so that it doesn't run until the end?

charlietsai avatar Dec 22 '23 06:12 charlietsai