Coder Social home page Coder Social logo

Comments (6)

Acconut avatar Acconut commented on July 18, 2024

As far as I know it has default infinity timeout and is waiting for resuming connection too long.

Correct, if you don't specify any timeout in your Go HTTP handler a value of 0 is used for read timeouts, indicating that no upper limit is set at all.

However, you can define one by creating your own HTTP server:

server := &http.Server{
    ReadTimeout: 60 * time.Second,
    …
}
server.ListenAndServe(…)

The tusd command we provide doesn't do this but I will add an option for it and document this in the README.

from tusd.

LukaszMarchewka avatar LukaszMarchewka commented on July 18, 2024

ReadTimeout is define timeout for whole connection (probably - i don't know go). So if everything works but takes more than 1 minute, server will terminate connection. Can you set timeout for idle?

from tusd.

Acconut avatar Acconut commented on July 18, 2024

http.Server.ReadTimeout is a wrapper around the net.Conn.SetReadDeadline method (https://golang.org/pkg/net/#Conn). More information can be found there.

So if everything works but takes more than 1 minute, server will terminate connection.

Yes, the connection will be closed if the read operation times out.

Can you set timeout for idle?

You can set a read and a write timeout. Is this not enough?

Anyway, I will do some testing on my site and then report back.

from tusd.

LukaszMarchewka avatar LukaszMarchewka commented on July 18, 2024

You can set a read and a write timeout. Is this not enough?

I don't know how long upload takes, sometimes 1 minutes is enough but other time I need much more.

from tusd.

Acconut avatar Acconut commented on July 18, 2024

Sorry, this fix is insufficient and does not fix your issue. I am working on it ATM.

from tusd.

Acconut avatar Acconut commented on July 18, 2024

I was able to test your second szenario (Closing internet connection by turning off WiFi) and can confirm that the server does wait for data from the connection and therefore does not update the offset.

acd3a63 added a simple read timeout but not an idle read timeout. Latter is the correct version you asked for. This has been changed in 52eb00b and should be fine now.

@LukaszMarchewka: I don't know how long upload takes, sometimes 1 minutes is enough but other time I need much more.

I now added idle timeouts, so the total duration of an upload should not be relevant any more.

from tusd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.