Skip to content

Suggestions: TimeoutBody with absolute timeout (no reset on received frame) #623

@liss-h

Description

@liss-h
  • I have looked for existing issues (including closed) about this

Feature Request

A type like timeout::TimeoutBody, but it does not reset the timeout when a frame is received/sent, thus serving as a timeout on receiving/sending the whole body.

Motivation

For public endpoints (e.g. public SPARQL endpoints) you sometimes want to ensure that user don't take up too much of your server's time. For this purpose you would use a timeout for finishing the request and transferring all data. Tower currently does not have a way to put an absolute limit on the time spent a request, because TimeoutBody always resets the timeout once a frame is send/received.

Proposal

The implementation is almost a 1to1 copy of the existing TimeoutBody, except for the missing reset for the timeout. I don't think there are any potential issues. I can implement it if you are interested.

Alternatives

I have not found other alternatives for streaming responses specifically.

Metadata

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