Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unnecessary github api call #255

Conversation

bavarianbidi
Copy link
Contributor

There are only a few cases, where we get a job information from github where the runner name is not set.

For all this cases we do not need to check github API at all because these jobs are never ever get scheduled to a runner:

job.Action is:

  • queued: a queued job is just queued and not scheduled to a runner so we do not get a runner name from the GH API
  • completed: when conclusion=cancelled|failure github never scheduled the job to a runner and with that we do not get a runner name from the GH API

There are only a few cases, where we get a job information from github
where the runner name is not set.

For all this cases we do not need to check github API at all because
these jobs are never ever get scheduled to a runner:

job.Action is:

* queued:
  a queued job is just queued and not scheduled to a runner so we do
  not get a runner name from the GH API
* completed:
  when conclusion=cancelled|failure github never scheduled the job to a
  runner and with that we do not get a runner name from the GH API

Signed-off-by: Mario Constanti <[email protected]>
@gabriel-samfira
Copy link
Member

Could you add a check here:

For the runner name. And just log that there was no runner assigned and just return nil.

Saves us some unnecessary db queries and log spam

bavarianbidi added a commit to mercedes-benz/garm that referenced this pull request Jun 5, 2024
@gabriel-samfira gabriel-samfira merged commit 7ee235a into cloudbase:main Jun 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants