Does anyone have a moment to sanity-check me on As...
# questions
s
Does anyone have a moment to sanity-check me on Async promises in a demo app (v5.2.6): https://github.com/seanoc5/grails-test-bundle? I could not get the https://github.com/grails-guides/grails-async-promises.git guide project to work, so created the test bundle above. The Readme has a few questions (mostly reminders to myself), but the main issues I am hoping for feedback on are: • the pros/cons of adding method with promises rather than DelegateAsync Transformation ◦ is the delegation just a more convenient way to do what I hacked out? • how to handle the tasks returned (promises)? ◦ Is that basically covered (implicitly) in the rest of the doc (from section 3 down)? Thanks! my documentService.fetchPromise() code:
Copy code
@CompileDynamic
    Promise<List<String>> fetchPomised(List<Document> documentList) {
        <http://log.info|log.info> "Fetch with promises (${documentList.size()}) docs..."
        PromiseList<String> list = new PromiseList<String>()
        documentList.each {Document doc ->
            <http://log.info|log.info> "fetch doc: $doc"
            list << task {
                fetch(doc)
            }
        }
        <http://log.info|log.info> "return from promise land..."
        return list
    }
note: I missed the instruction to
import static grails.async.Promises.*
, I expect that is just me, but leaving it as a note here in case there are others like me who leap into code before RTFM...