Hi Jochen, Matt,

Thanks for the example and the follow-up.

`defer` for `channel.close()` is still the right cleanup tool, and keeping the 
`Awaitable` from `async` so you can `await` it after the `for await` loop 
remains the cleanest way I see to surface the producer exception without 
inventing `async { } finally { }`.

On the hang / dropped-exception side: that is covered by GROOVY-12459 / 
https://github.com/apache/groovy/pull/2987 (merged), which closes the channel 
when the producer fails and documents the recommended channel + defer + await 
pattern. Further tightening of unused `Awaitable` / fire-and-forget error 
visibility can stay a docs or Groovy 7 discussion if we want it.

Cheers,
Daniel Sun

Reply via email to