jira-tools icon indicating copy to clipboard operation
jira-tools copied to clipboard

JST_EPICLABEL is very slow for fetching a huge list of issues.

Open Adel-Magebinary opened this issue 3 years ago • 3 comments

We would like to have an EPIC label showing for each row item for our JIRA spreadsheet. However, looks like the only way to fetch the label is to use JST_EPICLABEL to query API again to get the labels. When they are 5000 or more Jira issues, the sheet is query 5000 times to fetch Epic label for spreadsheet visitors.

Expected result

** Tell us what should happen **

  1. Instead of query api for every row item, it should fetch the text from the API directly when crateing the JIRA spreedsheet.

Actual result

** Tell us what happens instead ** When they are 5000 or more Jira issues, the sheet is query 5000 times to fetch Epic label for every spreadsheet visitors. As sometimes the API query will fail to fetch the results.

Adel-Magebinary avatar Sep 07 '21 02:09 Adel-Magebinary

As of developing the functionality, JIRA did/does not propagate the required EPIC data as part of the Jira issue data. Therefore i had to fetch the Epic data in an separate api call. When you create a Jira issue table / list of issues and include the field EPIC to be part of the response (Table column) it will add all EPIC data as you intended to visualize - still the EPIC column would get updated individually after the table is generated but automatically.

ljay79 avatar Sep 24 '21 07:09 ljay79

Hi Jens

Perhaps there could be some caching in the function so that every call to the function does not always generate a call to the JIRA API? This would not speed up all calls to the function but on large sheets there may be multiple calls to the function for the same TicketID which would not be necessary.

In pseudo code here

function JST_EPICLABEL(TicketId) {
  customFunctionAllowed_();
  if (requestCachedOrInProgress(TicketId)) {
      return resultFrom(TicketId);
  } else {
     var request   = new Request();
     storeRequestForTicketId(TicketId);
     .....
  }

Thats just to illustrate the idea, very rough pseudocode. I think the caching code should be more generic to work on all the sheet custom functions.

Just an idea.

paul-lemon avatar Sep 24 '21 08:09 paul-lemon

Hey guys, another method would be improving the overall .call function for querying.

Instead of fetch() for all API calls, we could implement .fetchAll() by Google Script.

https://gist.github.com/tanaikech/c0f383034045ab63c19604139ecb0728

Cheers, Adel.

Adel-Magebinary avatar Nov 11 '21 00:11 Adel-Magebinary