Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What happens if a cache fails to download #116

Closed
jakearchibald opened this issue Nov 1, 2013 · 2 comments
Closed

What happens if a cache fails to download #116

jakearchibald opened this issue Nov 1, 2013 · 2 comments

Comments

@jakearchibald
Copy link
Contributor

this.oninstall = function(event) {
  var core = new Cache(
    // urls
  );
  var level1 = new Cache(
    // urls
  );
  var level2 = new Cache(
    // urls
  );

  caches.set('core', core);
  caches.set('level1', level1);
  caches.set('level2', level2);

  event.waitUntil(Promise.all([core, level1]));
};

Here I only want to wait until the core & level1 download. I'm happy for this to be my offline experience, and level 2 etc will download in the background.

If core or level1 fail, that's covered by #115, but what if level2 fails?

I suppose I could do:

this.onfetch = function(event) {
  if (event.type === 'navigate') {
    caches.forEach(function(cache) {
      cache.ready().catch(cache.update.bind(cache));
    });
  }

  //...
}

Or should failed cache creation/update be automatically retried?

@KenjiBaheux
Copy link
Collaborator

@jakearchibald

Does the latest spec capture the expected behavior? I'm thinking of the following sentence: "If any oninstall handler throws an exception, or if any lifetime extension via event.waitUntil() fails (via promise rejection), installation fails and activation is not carried out. "

I'm assuming that the latest incarnation of caches.set (*) would throw if it fails.
*: I couldn't find it in CacheStorage interface, will double check with the team and file a new issue if appropriate.

Should this issue be closed? If not can you explain what's missing?

Background:
I'm going over the open issues, hoping to understand the potential impact against our current implementation.

@jakearchibald
Copy link
Contributor Author

Yeah, spec covers this.

As for caches.set, we're still debating whether it should exist vs caches.create(name). We'll definitely have the latter, but unsure whether we should have the former & allow new Cache() to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants