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

Short-circuit downloadDelay #1

Closed lorensr closed 8 years ago

lorensr commented 8 years ago

https://github.com/jamielob/reloader/blob/master/packages/reloader/reloader.js#L42-L63

Timer should be worst-case – can also have an autorun that does it immediately on updateAvailable true

jamielob commented 8 years ago

@lorensr: Can't do that without a better API. If we update automatically at that point, and there is a newer HCP waiting, it will take multiple starts of the app to get it up to date.

lorensr commented 8 years ago

I see. I was thinking about my only-post-install scenario.

In the general case, to avoid the situation you mention, you could do it only when it's not initially available:

if updateAvailable
  # check for even newer update
  setTimeout ->
    if updateAvailable
      update()
    else
      release()
  , downloadDelay
else
  # wait until available or give up on timeout 
  Tracker.autorun (c) ->
    if updateAvailable
      update()

    setTimeout ->
      c.stop()
      release()
    , downloadDelay
jamielob commented 8 years ago

@lorensr - Playing with possible ways to do this with options. I've added a section to the Readme outlining possible refresh and check options. Can you think of any scenarios that a combination of these wouldn't cover?

https://github.com/jamielob/reloader/tree/master/packages/reloader#possible-refresh-modes

lorensr commented 8 years ago

Looks good! Not clear from check section what happens during checking (launchscreen up)

jamielob commented 8 years ago

Very good point!

jamielob commented 8 years ago

@lorensr - I've refactored the package and simplified the options. I believe that I still cover all of the use cases we discussed. Your main case would simply be covered by setting Reloader.check = 'firstStart'.

Here's the new readme: https://github.com/jamielob/reloader/tree/master/packages/reloader

Mind giving it a spin?

lorensr commented 8 years ago

Thanks! I will once I switch to 1.3 :) few notes now tho:

Reloader.configure({
  check: 'firstStart',
  checkTimer: 6000
})
jamielob commented 8 years ago
jamielob commented 8 years ago

Items 1 and 3 taken care of and you're not getting 2 ;)

lorensr commented 8 years ago

Yay!

Now see if I was nitpicking I would say who doesn't have spaces after // ?! 😜

jamielob commented 8 years ago

//AllTheRageInEurope

lorensr commented 8 years ago

Oh, I guess that's okay then. Europeans are supposed to be cultured.

On Wed, Apr 20, 2016 at 8:06 PM, Jamie Loberman notifications@github.com wrote:

//AllTheRageInEurope

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/jamielob/reloader/issues/1#issuecomment-212659406

lorensr commented 8 years ago

Alright, I figured out the right lisp to get my editor to switch to tabs. Just for you 😊

On Wed, Apr 20, 2016 at 8:06 PM, Loren Sands-Ramshaw lorensr@gmail.com wrote:

Oh, I guess that's okay then. Europeans are supposed to be cultured.

On Wed, Apr 20, 2016 at 8:06 PM, Jamie Loberman notifications@github.com wrote:

//AllTheRageInEurope

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/jamielob/reloader/issues/1#issuecomment-212659406

jamielob commented 8 years ago

Haha. did you see this commit: https://github.com/jamielob/reloader/commit/e511abe85058a3c3a70debfc09dd0a4473924343