nordnet / cordova-hot-code-push

[DEPRECATED] - This plugin provides functionality to perform automatic updates of the web based content in your application.
https://github.com/nordnet/cordova-hot-code-push/issues/371
MIT License
979 stars 467 forks source link

getInputStream take 30 to 31 seconds for a chcp.json file #324

Closed Rakiah closed 6 years ago

Rakiah commented 7 years ago
Problem

On android devices, fetching an update even if there is nothing to update may take 30 to 31 seconds, this problem is extremly strange and with a lot of effort and debug I managed to isolate the problem which look like this one : https://stackoverflow.com/questions/1920623/sometimes-httpurlconnection-getinputstream-executes-too-slowly but the responses in this thread didn't managed to make it work, what is sure is that getInputStream was what took 30 to 31 seconds (30 to 31 seconds is very precise because this is the exact time it took EVERYTIME it had a problem, because yes, the problem appeared pretty much randomly like 50% of the time), also, this exclusively happened in the downloadJson in the JsonDownloader class, and most of the times was when request the chcp.json file

Steps to reproduce

I can't really say for sure that it will works for you and what i did was on a full and well advanced project, so that may not help, but all i did was to follow the installation steps, cordova run android, and the bug started to appear

System info

Run cordova info (or ionic info) and paste it here, or give us information like:

Plugins

cordova-hot-code-push-plugin/ cordova-plugin-add-swift-support/ cordova-plugin-badge/ cordova-plugin-calendar/ cordova-plugin-compat/ cordova-plugin-device/ cordova-plugin-inappbrowser/ cordova-plugin-splashscreen/ cordova-plugin-statusbar/ cordova-plugin-whitelist/ ionic-plugin-keyboard/ onesignal-cordova-plugin/

What i did to make it work

I found a solution after trying pretty much everything, I had very little time to find a solution so I didn't had time to clean up to find what is really helping there, but this definitely fixed the bug, I ended up forking this project and adding directly the git repo as my plugin, so I don't know if you guys have the same bug and may be interested in integrating my changes, I just post it here and feel free to do whatever you want with it https://github.com/nordnet/cordova-hot-code-push/compare/master...Mfron-42:fix-slow-fetch-updates

nordnet-deprecation-bot commented 6 years ago

👋 Hi! Thank you for your interest in this repo.

😢 We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

🔒 This will now be closed & locked.

ℹ️ Please see #371 for more information.