Skip to content

Why do client socket resets cause pending Deferred to be cancelled? #546

Open
@KentShikama

Description

Imagine you have a route like the following.

    @app.route("/foo", methods=["POST"])
    @inlineCallbacks
    def doStuff(self, request):
        yield foo()
        yield bar()
        return {"message": "success"}

And then a client calls POST /foo and disconnects right after Klein finishes processing foo(). Currently, bar() would get cancelled. I understand that the socket has closed so that the {"message": "success"} cannot be written back but it would be nice if the Deferred bar() was executed. Is there some use case that I'm failing to understand here?

Or to put it differently, I believe we should stop executing the .cancel() on the Deferred if the request finishes at

lambda _: d.cancel(),
.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions