Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort streams early when possible #26

Open
vfazio opened this issue Mar 18, 2022 · 0 comments · May be fixed by #27
Open

Abort streams early when possible #26

vfazio opened this issue Mar 18, 2022 · 0 comments · May be fixed by #27

Comments

@vfazio
Copy link
Collaborator

vfazio commented Mar 18, 2022

If an RPC endpoint raises some error, the only time the client is notified is by awaiting the stream object itself:

    async def client_stream(stream: Stream):
        raise ValueError("This should cause transactions to fail")

    manager = RPCManager()
    manager.register("client_stream", client_stream)
    
    with client.request_stream("client_stream") as stream:
        for i in range(1000000):
            await stream.send(i)  # all items are sent despite the error raised in the remote 
    await stream  #error is raised happens here

When performing large send operations or send/receive functions, it may make sense to abort or raise an error as soon as some error condition has been detected so further cycles aren't spent trying to handle data when there's no remote processing it.

@uSpike uSpike linked a pull request Mar 23, 2022 that will close this issue
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 a pull request may close this issue.

1 participant