parallel-processingjiragpars

Parallel groovy script (in Jira via Scriptrunner)


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.


Solution

  • 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