https://kotlinlang.org logo
#coroutines
Title
# coroutines
m

Mani

10/28/2019, 1:04 PM
Folks, quick help. Is this a right way?
Copy code
slackIncomingHook.sendText(SlackMessage("Attempting RTS for son's of length: ${stockOutwardNoteIds.size}, warehouseId: ${warehouse.id()}"))
stockOutwardNoteIds.map {
         async {
                           warehousing.packStockOutwardNote(warehouse.id(), it)
                           freshRTSHelper.markRTSForFreshOrder(warehouseId = warehouse.id(), stockOutwardNoteId = it)
                    }
         }.awaitAll()
m

marstran

10/28/2019, 1:05 PM
So what are you trying to do?
m

Mani

10/28/2019, 1:06 PM
take a bunch strings and want to do an action on them in parallel as they're all independent. Also,
freshRTSHelper.markRTSForFreshOrder
this is just an IO call.
m

marstran

10/28/2019, 1:06 PM
Ok, and do you need the result of the call?
m

Mani

10/28/2019, 1:07 PM
not really, but I want to know whether all of them got succeeded or not, that is why the next slack message
m

marstran

10/28/2019, 1:16 PM
Ok, will it throw an exception if it fails or?
m

Mani

10/28/2019, 1:22 PM
no it wont
it does send response as 500, 404 etc..,
m

marstran

10/28/2019, 1:24 PM
Ok, so you need the response then. It seems good to me, as long as you have scoped your
async
correctly.
5 Views