Parallel groovy script (in Jira via Scriptrunner)

1.2k Views Asked by At

I need to parallelize my script (it creates few subtasks) in Jira ServiceDesk that runs via ScriptRunner. I need to find a way for parallel creation tasks because when SomeUser creates task, it takes a long time for waiting while all subtasks creates. Have any idea how to do it? I tried to import GPars to my script, but Jira can't find matching method for this.

1

There are 1 best solutions below

2
sintasy On BEST ANSWER

Just do it in another thread/s.

Thread.start {
    crateIssue(summary, description)
    crateIssue(anotherSummary, anotherDescription)
}

or

Thread.start {
        crateIssue(summary, description)
    }
Thread.start {
        crateIssue(anotherSummary, anotherDescription)
    }

After you starting thread ScriptRunner forgot about it and immediately returns that post function is ends. User dont be wait when all threads will be finished.

*createIssue is fake function only for example