Android Question [Resolved] SimpleMediaManager: set the request timeout

TILogistic

Expert
Licensed User
Longtime User
How can I set the request timeout to SimpleMediaManager?

see:
1646513979260.png
1646514033440.png


ResponseError. Reason: , Response: Image does not exist
java.net.SocketTimeoutException: timeout
at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:677)
at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.kt:686)
at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:143)
at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:96)
at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.executeWithTimeout(OkHttpClientWrapper.java:175)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper.access$0(OkHttpClientWrapper.java:172)
at anywheresoftware.b4h.okhttp.OkHttpClientWrapper$ExecuteHelper.run(OkHttpClientWrapper.java:220)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
regards.
 

William Lancee

Well-Known Member
Licensed User
Longtime User
I looked at the B4XLib and could not find any exposed parameter for this. However you could try
modifying SimpleMediaManager.bas. Around line 250 add a timeout line. Use the modified module instead.

B4X:
            Dim job As HttpJob
            job.Initialize("", Me)
            job.Download(Media.Meta.FirstUrl)
            job.GetRequest.Timeout = 60000        'some number between 3000 and 10000?

It is too complicated for me too test.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I looked at the B4XLib and could not find any exposed parameter for this. However you could try
modifying SimpleMediaManager.bas. Around line 250 add a timeout line. Use the modified module instead.

B4X:
            Dim job As HttpJob
            job.Initialize("", Me)
            job.Download(Media.Meta.FirstUrl)
            job.GetRequest.Timeout = 60000        'some number between 3000 and 10000?

It is too complicated for me too test.
I thank you for your reply.

But I know where to modify the Library to fix it.

I just thought there might be another solution to set the parameters of the job request

I've only seen in the library code an exposed parameter, but it's just a sleep between downloads.

SleepDurationBeforeDownload

1646526952380.png


Regards.
 
Upvote 0
Top