S
S
Seva2017-03-20 17:31:28
Grails
Seva, 2017-03-20 17:31:28

Asynchronously populating an array in Grails 3?

Hi friends.
I'm not a real backend welder, but there was a need to do something on Grails 3.

def getFormOptions() {
    def output = [:];

    output.educationTypes = getEducationTypes();
    output.familyStatusTypesList = getfamilyStatusTypesList();
    output.spousesSocialStatus = getSupouseSocialTypesList();

    render output as JSON
  }

Inside all these getSomething are HTTP requests. Now everything happens sequentially - first output.educationTypes (waiting for the request to complete), then output.familyStatusTypesList and so on. It turns out very long. How can I fix it so that everything runs in parallel? Thank you.
PS Doc saw how to apply to a specific task - did not think of it.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question