triniwiz / nativescript-downloader

Apache License 2.0
32 stars 18 forks source link

Timeout #22

Closed nicHoch closed 6 years ago

nicHoch commented 6 years ago

Hi i using the plugin to download large JSON data from an API endpoint. It is working well. But some endpoints are very computational intensive and I get a timeOut message before any data arrived.

is there a way how to configure the timeout for the Time to first byte?

Which platform(s) does your issue occur on?

triniwiz commented 6 years ago

IOS has a higher default timeout (60s) than android (10s) but I can add a prop to set a custom timeout

nicHoch commented 6 years ago

that would be awesome.

triniwiz commented 6 years ago

@nicHoch it's done 😄 both has a default of 60s now also you can now set the timeout with the static method setTimeout() all request will use the same timeout

nicHoch commented 6 years ago

@triniwiz Thaks for the update - very mush appreciated! the extended default timeout on Android is working very well. But if i use the static setTimeout method as shown in the readme

    Downloader.init();
    Downloader.setTimeout(90);

i got following error:

System.err: com.tns.NativeScriptException:
System.err: Calling js method run failed
System.err: TypeError: manager.setTimeout is not a function
System.err: File: "file:///data/data/com.thecrag.thecragapp/files/app/tns_modules/nativescript-downloader/downloader.js, line: 21, column: 16
System.err: StackTrace:
System.err:     Frame: function:'Downloader.setTimeout', file:'file:///data/data/com.thecrag.thecragapp/files/app/tns_modules/nativescript-downloader/downloader.js', line: 21, column: 17
System.err:     Frame: function:'', file:'file:///data/data/com.thecrag.thecragapp/files/app/pages/init/init.js', line: 138, column: 62

any ideas?

i already cleaned the platform/android and tempPlugin folder.

triniwiz commented 6 years ago

@nicHoch try nuking the platforms it should pull in the new lib the plugin uses 😄

nicHoch commented 6 years ago

@triniwiz hmmm i nuked everything but still the same error.

alereisan commented 5 years ago

@triniwiz I have the same error as @nicHoch when using Downloader.setTimeout() - nuked everything before

triniwiz commented 5 years ago

Can you try calling the after the app has started app.on('launch',function(){ .Downloader.setTimeout() })

alereisan commented 5 years ago

@triniwiz It still shows Error (different app): ERROR TypeError: manager.setTimeout is not a function

MonasteryJohn commented 5 years ago

I know this issue is closed, but using version 2.1.0 I am seeing the same behavior. It doesn't matter at what point in the app lifecycle it is called, the error "manager.SetTimeout is not a function" happens every way that I've tried it.

rahadur commented 5 years ago

I have the same problem. 😓

JS: ERROR Error: Uncaught (in promise): TypeError: manager.setTimeout is not a function
JS: TypeError: manager.setTimeout is not a function
JS:     at Function.Downloader.setTimeout (file:///data/data/app.xplatform.downloadmanager/files/app/tns_modules/nativescript-downloader/downloader.js:21:17)
JS:     at Object.<anonymous> (file:///data/data/app.xplatform.downloadmanager/files/app/app/home/home.component.js:7:38)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/app.xplatform.downloadmanager/files/app/app/home/home-routing.module.js:5:24)
JS:     at require (<anonymous>:1:266)
JS:     at Object.<anonymous> (file:///data/data/app.xplatform.downloadmanager/files/app/app/home/home.module.js:6:29)
JS:     at require (<anonymous>:1:266)
JS:     at file:///data/data/app.xplatform.downloadmanager/files/app/tns_modules/tns-core-modules/globals/globals.js:81:32
JS:     at new ZoneAwarePromise (file:///data/data/app.xplatform.downloadmanager/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:902:...

Environment

√ Getting NativeScript components versions information...
‼ Update available for component nativescript. Your current version is 5.2.0 and the latest available version is 5.2.1.
√ Component tns-core-modules has 5.2.2 version and is up to date.
√ Component tns-android has 5.2.1 version and is up to date.
√ Component tns-ios has 5.2.0 version and is up to date.
finger563 commented 5 years ago

also seeing the same issue

tauanbinato commented 4 years ago

Same here, TypeError: manager.setTimeout is not a function for android