jamielob / reloader

More control over hot code push reloading for your production apps. Designed to replace mdg:reload-on-resume and provide a more production-ready approach.
28 stars 22 forks source link

Possible configurations #6

Closed jamielob closed 7 years ago

jamielob commented 8 years ago

Working blueprint

When to do additional checks:

When to reload the code already downloaded:

How to differentiate between a start and a resume:

jamielob commented 8 years ago

Default:

Reloader.configure({
  check: false,
  reload: 'start',
  resumeMethod: 'eventAndTimer',
  resumeTimer: 1000 * 60 * 60, // 1 hour
  launchScreenDelay: 100,
});
lorensr commented 8 years ago

For reload: start, we're never calling .reload(), so we don't need resumeMethod/Timer, right? I'm fine w/ rest, let's just strongly recommend at least check first start :)

jamielob commented 8 years ago

I think we do - because if the resumeTimer runs out then it would be considered a start next time.

jamielob commented 8 years ago

Also, I think you're right to have check on firstStart as the default. I'll adjust above.

lorensr commented 8 years ago

I would say that's reload: startAndResume with a resume minimum 1 hr.

jamielob commented 8 years ago

But consider this situation. reload: 'start' is set.

This is why I think we need a timer that says, if you come back to the app within a certain time, it should always be considered a resume.

This is based on the scenario provided here: https://github.com/jamielob/reloader/issues/3

lorensr commented 8 years ago

App is reloaded because it considers it a "start".

We can't stop that from happening, right? With 1.3, if new code has been downloaded, it will be used on the next cold start?

jamielob commented 8 years ago

Hmmm. Yeh I think you're right, I'd forgotten that bit. In that case I don't think there's a need for resumeMethod - I only introduced that to combat the above scenario.

jamielob commented 8 years ago

@lorensr You had previously mentioned two timers, one for check and one for resume - what scenario's were you thinking those would be used for?

lorensr commented 8 years ago
{
  check: 'firstStart'
  checkIdleCutoff: N/A
  checkTimer: 3000
  reload: 'startAndResume'
  reloadIdleCutoff: 1 hour? dunno. just don't want it restarting when the user is multitasking, and about to come back to the app soon.
  launchScreenDelay: 0
}

one for reload startAndResume, and one for check: everyStart

adamgins commented 7 years ago

@jamielob cool package - I have been hitting some issues with reload on resume (see https://github.com/meteor/meteor/issues/7876#issuecomment-260181121 ) and wanted to check if there's a config I could use for manual updates?

ie always be manual, use the updateAvailable helper to allow a user to manually get a hot code push.

lorensr commented 7 years ago

@adamgins yes you could do check: false, although I would at least do 'firstStart', and refresh: 'start' (default behavior in current Meteor)

adamgins commented 7 years ago

Hi @lorensr thanks, I am still seeing some refreshes on some users' phones without displaying the "click to reload". Always hard to debug on someone's physical phone, but I wanted to check two things regarding my configuration:

Reloader.configure({
    check: 'firstStart', // Check for new code every time the app starts
    checkTimer: 5000,  // Wait 3 seconds to see if new code is available
    refresh: 'start', 
    idleCutoff: 1000 * 60 * 10  // Wait 10 minutes before treating a resume as a start
});

So I am thinking of a couple of causes:

1) The user does not have the latest code... I had not refreshed the appStore yet, so reloader is not actually running

2) My settings allow a refresh

3) perhaps a bug

If I only want manual refreshes, ie via

          {{#if updateAvailable}}
                <div class="alert alert-success alert-dismissable">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <a class="button" reloader-update>Tap here to update the Buzzy app!</a>
                </div>

            {{/if}}

Are my settings correct or can the app refresh without a user clicking the button?

thanks for the help

lorensr commented 7 years ago

Are my settings correct

Yep. And idleCutoff is unnecessary.

jamielob commented 7 years ago

@lorensr - closing the v2 issues since it looks like we've both moved on to React Native and probably won't improve this package.