-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Improve performance of New-
/Set-JiraIssue
on instances with large quantities of fields
#516
Improve performance of New-
/Set-JiraIssue
on instances with large quantities of fields
#516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix tests
Will do, I'll give it a look this evening. Thanks for approving the CI pass! |
@lipkau Dug into this a bit - the problem appears to be that the unit tests use a mock for (As an aside, it would be in our best interest to upgrade to Pester 5) |
@lipkau Unit tests should be green again. Can you click the "Approve and run" button to re-approve running test workflows? |
shall we document something about further refactoring in this area? |
@lipkau When I'm back at my desk, I can cut an issue for:
Anything else you see as being necessary here? |
@lipkau Issues have been filed. Can you merge the PR when you have a moment? |
Description
This PR adjusts the functionality of
New-JiraIssue
andSet-JiraIssue
to only callGet-JiraField
once (if-Fields
is set) instead of once per entry in the-Fields
hashtable.Additionally, both cmdlets will resolve numerical IDs for custom fields if users specify fields in that way (i.e.
-Fields @{12345 = $foo}
is equivalent to-Fields @{customfield_12345 = $foo}
)Motivation and Context
Get-JiraField
takes a-Name
parameter, however the underlying API call is not filtered by name. This means that every field in the instance (visible to the current user) is retrieved for each key in-Fields
. This means network traffic/CPU usage/time spent scales quadratically in practice (linear to the number of CFs in the API call and the number of CFs in the instance).By moving
Get-JiraField
out of this loop (thus only calling it once), we can cache field data instead of hammering Jira's API for it.Closes #515.
Improvement Areas
We currently query the whole instance's fields which, on larger (or poorly-organized) instances, may:
Using the CreateMeta and EditMeta endpoints (with
Get-JiraIssueCreateMetadata
andGet-JiraIssueEditMetadata
) would reduce response size and limit fields to ones that are actually relevant to the current project/issue context.Types of changes
Checklist