Skip to content

Conversation

@phlax
Copy link
Member

@phlax phlax commented Jan 19, 2022

Signed-off-by: Ryan Northey ryan@synca.io

the concurrent util provides an async generator that yields results from awaitables as they are available.

depending on the type of iterable passed to the util, it can also consume results from a (potentially async) generator in order to derive the iteration of awaitables.

currently, it accepts an argument yield_exceptions - this has effect if any of the awaitables raise an error while being awaited

yield_exceptions currently has no effect if an error is raised while consuming the provided iterable, and instead a ConcurrentIteratorError is raised

this PR will make yield_exceptions have the same effect upon an error raised while consuming its iterable, which means it can potentially continue iterating if the iterator is not blown

Signed-off-by: Ryan Northey <ryan@synca.io>
@netlify
Copy link

netlify bot commented Jan 19, 2022

✔️ Deploy Preview for nifty-bassi-e26446 ready!

🔨 Explore the source changes: 9710c9a

🔍 Inspect the deploy log: https://app.netlify.com/sites/nifty-bassi-e26446/deploys/61e7e200f3308e0008cb11a1

😎 Browse the preview: https://deploy-preview-183--nifty-bassi-e26446.netlify.app

yield_exceptions=yield_exceptions)
async for thing in things:
yield thing[0]
if yield_exceptions and isinstance(thing, Exception):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if not yield_exceptions: raise thing

or (isinstance(result, ConcurrentError)
and not self.yield_exceptions))
not self.yield_exceptions
and (isinstance(result, ConcurrentIteratorError)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConcurrentIteratorError is a ConcurrentError - rationalize this

@phlax
Copy link
Member Author

phlax commented Jan 21, 2022

closing this for now, not sure if its wanted, and found better way to handle

@phlax phlax closed this Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant