AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
323 stars 131 forks source link

Performance #62

Open lipkau opened 7 years ago

lipkau commented 7 years ago

I am having trouble with this module because of it's performance. Let me explain: when making changes to an issue, this module does a lot of queries to validate data (field y, user, etc) However, when walking through a list of ~300 issues, the time the script takes to process all API calls takes a very long time, whereas other tools (Python library for jira's API) does the same in few minutes.

I have a script in which I do a couple of actions ( create issue with approx 20 fields, edit issue because field was not in creation screen, create links to other issues). There script takes about 2 minutes to finish a ticket before moving to the in the loop.

replicaJunction commented 7 years ago

Yeah, I could see the data validation stuff getting in the way when you're working on that scale.

I don't want to totally drop the data validation logic, because I think it's helpful for users just starting to figure out how the module works, or when working interactively with the module via an interactive shell rather than a script.

How would you feel about some sort of -SkipValidation switch on functions like New-JiraIssue that make a lot of API calls?

lipkau commented 7 years ago

That sounds great.

This parameter must then be passed on to the private functions

Do you want help implementing this?

lipkau commented 7 years ago

I had an idea: Keeping the validation pretty much as-is, but caching the information (such as fields, projects, etc). This information would be cached either in the module's private data, or in a module private variable. Changing the ConfigServer would clear the cache. Once a validation fails, a function could run to update the cache and retry the validation (once only)

once #45 is implemented, this cache can be persisted between sessions in a file (binary?) in the %AppData%\AtlassianPS\JiraPS\.

tuxgoose commented 6 years ago

I would ask if you could add in an additional parameter to get-jiraissue so that we may limit the amount of fields we request. As it stands it currently gets all fields. This can be particularly frustrating when you have numerous custom fields and/or when you are querying numerous issues.
Param( [Parameter(ParameterSetName = 'Fields', Mandatory = $false)] [string]$Fields, )

Process{ Line 104- $issueURL = "$($server)/rest/api/latest/issue/${k}fields=$fields&expand=transitions" }

dhegland commented 6 years ago

I am right there with @tuxgoose !

tuxgoose commented 6 years ago

lipkau, my intention was to pass the a single or list of fields in the from the get-jiraissue to invoke-jiramethod to invoke-webrequest. If possible could I be assigned this task or if this would be part of another issue/feature should I create an additional?

lipkau commented 6 years ago

yes, please create a new issue. feel free to work on this and submit a PR :-)