Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
Currently, when an error occurs, we emit the error immediately. Once an error is emitted from the generator we typically discard it and all related state. Unfortunately, in readahead situations, there may be outstanding tasks, and these may be referencing that related state.
Currently, we avoid errors in this situation through the copious use of shared_ptr. This has led to excess complexity and potential performance issues.
Instead, we can update the rules for async generators to only emit a terminal item once all outstanding tasks have completed. At this point we should be able to safely tear down all of the state. Furthermore, if we can ensure consumers drain an async generator before they destroy it (this can be done in a follow-up issue), we can get rid of a lot of our shared_ptr and simplify some of the complexity of the async reader code.
Attachments
Issue Links
- links to