Processing large batches
In version 3.0.21 we enhanced the capability to process large batches. This is important in scheduler jobs, or in SIL Manager ad-hoc scripts, where you may sometimes need to load a lot of issues then, depending on the data, you will need to change them and send them back to your Jira.
The basic usage is as follows:
int i = 0;
for(string k in selectIssues("project = TEST", 1000)) {
i++;
%k%.description += "\n\nmodified"; //modify here the issues
if(i % 10 == 0) {
saveModifiedIssues(); //!!! saves the 10 issues AND clears the memory !!!
}
}
Here, we process max 1000 issues, change the description of the issue, then, every 10 issues we save the issues and clear the memory occupied by them. Note that you still need to have enough memory to load the initial issues.
Should you access any issue again, it will be reloaded from Jira, as the following example shows:
TEST-1.description += "\n\nmodified";
saveModifiedIssues(); //saves TEST-1
if(TEST-1.assignee == currentUser()) { //this triggers a reload of the issue, behind the scenes
//.....
}
On Jira DataCenter / Server we could not do this, because of the implicit transaction we’re in when modifying issues. We cannot provide this functionality on Jira DC