microsoft / react-native-code-push

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

Possible to fix automatic rollbacks that occur? #880

Closed huangkaiw3n closed 5 years ago

huangkaiw3n commented 7 years ago

Description

A small number of users get automatic rollback sometimes. When that happens, they lose that update. I've experienced it before and a reinstall of the app allowed the code push to update the app successfully. Is there anything on the dev side to trigger something like this or some way to code the codePush syncing to attempt to sync again even after a rollback? So that an update is not lost to a user until a reinstall.

Additional Information

Eg. when I check the deployment stats:

screen shot 2017-06-10 at 12 49 00 am

My CodePush code in App.js (imported by index.ios.js and index.android.js)

let codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.IMMEDIATE
};

export default codePush(codePushOptions)(App)
yuri-kulikov commented 5 years ago

Hello everybody!

I'm glad to inform you that we've implemented the "Re-try mechanism for CodePush Rollbacks" feature.

CodePush rollbacks can occur for several reasons including closing an app during install, faulty cellular reception, etc. When this occurred the app never re-tried to download this update which results in a customer being stuck on an old version of an app until the developer decides to push a new release or the user re-installs or clears the app (This is a bad experience). Users was essentially stuck running old versions.

This feature will allow users who have had some random rollback to eventually receive the last working update. We understand that this will not save people from rollbacks, as well as not fix the metrics (you’ll still see random rollbacks as well as additional download + install(/rollback) for every re-try), but users will finally be able to install an update that were rolled-back accidentally.

For example, you could set options like this:

syncOptions: { 
  ...
  rollbackRetryOptions: {
    delayInHours: 12,
    maxRetryAttempts: 1
  }
  ...
}

then use this options App = CodePush(syncOptions)(App) or CodePush.sync(syncOptions), and in this case, if a rollback occurs, then the application will ignore this update for 12 hours after the rollback, and then it can try to install this update again (but only once, as we have set in maxRetryAttempts). You can read more about how to use this options here.

We appreciate your feedback about this.

hobzcalvin commented 5 years ago

Thanks for this update. Can delayInHours be set to 0 for immediate retry? Seems to me that waiting some number of hours doesn't help much, but retrying the same update several times should eliminate one-off update errors.

My company (where I no longer work) had to scrap CodePush after significant effort implementing it because of this bug. (If we couldn't rely on CodePush to release important new app features it was useless to us.) Sadly, this fix probably comes far too late to consider adopting it again. We had no idea why rollbacks could even happen; AFAICT reasons like "closing an app during install, faulty cellular reception" were never previously mentioned. It's helpful to know this now, at least.

yaronlevi commented 5 years ago

Setting delayInHours=0 would cause an immediate retry?

yuri-kulikov commented 5 years ago

Hi @hobzcalvin, @yaronlevi Thanks for your feedback!

Can delayInHours be set to 0 for immediate retry?

Yes, you can set it to 0 (or, for example, 1 / 60 if you want to wait 1 minute), but if you set delay to 0 and unintentionally release a broken update, then each user might get some additional crashes and that's also a bad experience. Developers will need some time to disable the broken update or release a fixed update.

AFAICT reasons like "closing an app during install, faulty cellular reception" were never previously mentioned.

In fact, the reasons of this exceptional rollbacks can be quite unclear and we don't know each of them, it may be caused by some hardware issues, some unusual user actions or developer js-code issues, etc. Each case is quite individual and this feature can help users to mitigate these circumstances.

Setting delayInHours=0 would cause an immediate retry?

Not exactly, it will mean that during the next sync request with this options, the application will not ignore this package (until maxRetryAttempts is reached). For example, if you use it with CodePush.CheckFrequency.ON_APP_START(/ON_APP_RESUME) and a user got a rollback, then as soon as he launches the application, it will re-download the update right after the start and install it as usual.

yaronlevi commented 5 years ago

@yuri-kulikov Great feature (-: It's nice seeing React Native and CodePush going forward and improving all time.

yuri-kulikov commented 5 years ago

We close the issue, but if you find something or have some questions, please let us know!

mohamedsharaf commented 4 years ago

use .sync() without any param fix it

sh-muzzammil commented 3 years ago

Hello Guys , I am also facing the same issue on iOS. Unfortunately nothing has worked

This is my App.js

/**

// let codePushOptions = {checkFrequency: codePush.CheckFrequency.ON_APP_RESUME};

const codePushOptions = { updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, };

import {initializeLanguage} from './App/locales/index';

const App = () => { // Bootstrap(); [isLoaded, setIsLoaded] = useState(false); useEffect(() => { initializeLanguage().then((response) => { setIsLoaded(response); }); }, []);

codePush.sync({ updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE, });

if (isLoaded) { return ; } else { return (

Loading...!
);

} };

export default codePush(codePushOptions)(App);

YaoHuiJi commented 3 years ago

hi @yuri-kulikov , is rollbackRetryOptions removed in new version? I can't see it in new API document

I met this problem too, a few users stuck in old version, even I release a new update but it seems those users just ignore any new updates and stay at old version forever

vemahendran commented 1 year ago

App crashes is very normal now-a-days. There should be a way to disable the automatic rollback in AppCenter.

lklepner commented 1 year ago

Expo Update might be a better approach these days.