Giter VIP home page Giter VIP logo

Comments (10)

liujingxing avatar liujingxing commented on June 12, 2024

你是怎么设置的超时?读、写、连接超时各设置的多少?加载中时间大概多长?

from rxhttp.

HoneyWorld avatar HoneyWorld commented on June 12, 2024

@liujingxing 读、写、连接超时都是30s,但一直没有结果返回,超时也没有起作用,是okhttp的问题吗?

from rxhttp.

liujingxing avatar liujingxing commented on June 12, 2024

读、写、连接超时都是30s的话,最差的情况是90s才会触发超时异常。解决办法有两个:
1、读、写、连接超时时间设置短一点,如都设置10s,此时最差的情况也就30s内会触发超时异常
2、通过timeout方法,为单个请求设置超时时间,这个时间应小于读、写、连接超时时间之和。通过次方法设置的超时时间,就会在规定的时间内触发超时异常。

from rxhttp.

HoneyWorld avatar HoneyWorld commented on June 12, 2024

@liujingxing 好的,我试一下,多谢

from rxhttp.

liujingxing avatar liujingxing commented on June 12, 2024

嗯,遇到问题可以进群378530627,方便沟通

from rxhttp.

tawny1 avatar tawny1 commented on June 12, 2024

读、写、连接超时时间设置分别为30,30,10,
我为单个请求设置超时时间为50,
但是超时时间还是30s,请问这是为什么呢?

from rxhttp.

liujingxing avatar liujingxing commented on June 12, 2024

你要了解下读、写、连接超时及总超时的区别,看这里。https://github.com/liujingxing/okhttp-RxHttp/wiki/%E8%B6%85%E6%97%B6%E8%AE%BE%E7%BD%AE

from rxhttp.

tawny1 avatar tawny1 commented on June 12, 2024

读、写、连接超时时间之和为30s+30s+10s=70s,
timeout总超时时间为50s,
为什么是无效的呢?

from rxhttp.

liujingxing avatar liujingxing commented on June 12, 2024

举个例子,你要下载一个100M的文件,1s内就连接上了,接着开始下载,而下载会在while循环里不停的调用read方法,每次read,都会开启倒计时(时间为你设置的读超时),而如果第一次读就超时了,那从开始到超时就是31s,那么你设置总超时50s就不会触发。

from rxhttp.

tawny1 avatar tawny1 commented on June 12, 2024

好的 谢谢

from rxhttp.

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.