microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

Very slow codepush downloads in UAE resulting in UNKNOWN_ERROR #2444

Closed kyle-ssg closed 1 year ago

kyle-ssg commented 1 year ago

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

Steps to Reproduce

  1. Attempt to download (9mb) https://codepush.blob.core.windows.net/storagev2/ID

Expected Behavior

Downloads in a reasonable time

Actual Behavior

Takes 3-4 minutes on a 250mb line (in app it times out)

This is making CodePush unusable for people within this region.

I think could be a a general issue with Azure Blob storage, not sure where to raise though.

zeusstl commented 1 year ago

Experiencing slow updates everywhere. I am considering only running check updates once a week per user to avoid this. Would much prefer a proper solution than this hack, but haven't been able to find a solution to the slow updates and it really impacts the user's experience to wait 3-20 seconds each time they open their app.

AbdulBsit commented 1 year ago

Today I release the update, and experiencing very slow updates/or no updates at all, I tried debugging most of the times it says Network request failed even with the perfect internet

[CodePush] Network request failed

Also we can see on our network monitoring most of the request are failing with appcenter

Screenshot 2023-03-15 at 9 53 33 PM
kyle-ssg commented 1 year ago

In fairness, I've seen updates take <2 seconds in UK. But UAE is definitely very very slow - in our case, we had to fork / increase the download timeout of 60 seconds. From my understanding it's an issue with azure where the bundles are stored, we found that UAE took a couple minutes to download a PDF vs 1 second in UK.

https://github.com/SolidStateGroup/react-native-code-push/commit/53f9081301499414d0d1cd20d3079322b1b19663

Also it became clear that we needed to implement a progress handler (in fact thats how we diagnosed the download speed was so slow).

With an additional fork of react-native-bootsplash we were able to also get around the horrible slow blank screen when it's installing the downloaded update.


function CodePushStatusDidChange(syncStatus) {
  switch (syncStatus) {
    default:
    case codePush.SyncStatus.DOWNLOADING_PACKAGE:
      updating = true
      rootPush(RouteUrls.AppUpdatingScreen, {}, 'AppUpdating')
      break
    case codePush.SyncStatus.INSTALLING_UPDATE:
      RNBootSplash.show()
      break
    case codePush.SyncStatus.UNKNOWN_ERROR:
      rootPop()
  }
}

function CodepushProgressUpdate: DownloadProgressCallback = (val) => {
    setCodepushProgress({
      percent: parseInt(
        `${((val.receivedBytes || 0) / (val.totalBytes || 1)) * 100}`,
      ),
      ...val,
    })
  }

Result:

https://user-images.githubusercontent.com/8608314/225668907-235e6854-f4d5-412d-844f-4dd033c6a60d.mov

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.