What's wrong with the promises in Grails 3?

Hi!
Here's a simple example from official documentation:

def test() {
 def map = new PromiseMap()
 map['one'] = { 2 * 2 }
 map['two'] = { 4 * 4 }
 map['three'] = { 8 * 8 }
 map.onComplete { Map results ->
 render results as JSON
}
 }


The result is unpredictable and often wrong -

{"one":4,"two":16,"three":64}

Following the launch

{"one":16,"two":64,"three":4}

What the crap? Thank you.
June 28th 19 at 00:15
0 answer

Find more questions by tags Grails