Open hmmwhatsthisdo opened 1 month ago
Upon further inspection, Invoke-JiraIssueTransition
(though I haven't tried it) appears to have a similar problem - we're calling Get-JiraField
in a loop against the -Fields
param contents here:
https://github.com/AtlassianPS/JiraPS/blob/845495f7a1154b214210375798c2c334f58d1ae0/JiraPS/Public/Invoke-JiraIssueTransition.ps1#L150
There's not a meta endpoint for transitions, though the transitions API endpoint (when contextualized to a specific issue) should provide a map of properties available. This might be a better solve for parameters there (optionally falling back to EditMeta or the fields API)
Description
New-JiraIssue
andSet-JiraIssue
perform very poorly when a Jira instance has a large quantity of custom fields. Our development instance has 630 CFs defined and callingSet-JiraIssue
(with 3-5 Fields in the-Fields
parameter) takes roughly 8 seconds to complete. The underlying HTTP PUT to Jira's REST API for creating the issue is only about 150ms of this.Steps To Reproduce
-Fields
parameter to set a few custom fields for the given issue type.New-JiraIssue
Set-JiraIssue
Expected behavior
Response time is relatively performant/semi-aligned with Jira web UI
Screenshots
Your Environment
JiraPS 2.14.7
Possible Solution
New-JiraIssue and Set-JiraIssue appear to be calling
Get-JiraField
in a loop for each KVP in-Fields
. While the call toGet-JiraField
contains a-Name
parameter, the underlying API is unfiltered. This means that, when creating an issue and specifying 3 fields in the-Fields
parameter against an instance with 500 custom fields, we end up retrieving (and parsing!) 1,500 custom field entries.Two options seem to be available here:
Get-JiraField
out of theforeach
loops here and hereNew-JiraIssue
here, so this is likely a straightforward fix.