shindig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Dumont" <ddum...@us.ibm.com>
Subject Retrying failed gadget renders...
Date Wed, 18 Jul 2012 13:33:01 GMT
Has anyone thought of how to retry a gadget render that fails?

Currently we have a message that we insert into the site if we detect a 
failure, and we'd like to put a reload button.  But, after thinking about 
the code in shindig, and all of the lifecycle events in the container and 
the complexity of the navigate chain, I'm starting to feel pessimistic 
about doing this in a way that won't be really screwy.

For instance, in the gadget lifecycle, It's not clear that the lifecycle 
events for a site may each happen once...

So if I did something like:

(function() {
  var original = osapi.container.Container.prototype.navigateGadget,
      retries = {};
  // override
  osapi.container.Container.prototype.navigateGadget = function(site, 
gadgetUrl, viewParams, renderParams, opt_callback) {
    original(site, gadgetUrl, viewParams, renderParams, function
(gadgetInfo) {
      if (gadgetInfo.error) {
        // Don't call the original callback with the error, wait till we 
can retry it.
        retries[site.getId()] = function() {
          osapi.container.Container.prototype.navigateGadget(site, 
gadgetUrl, viewParams, renderParams, opt_callback);
        }; // User intervention will call this later... trust me.
      } else {
        opt_callback(gadgetInfo);
      }
    });
  };
})();
(Apologies for the formatting!  Are we allowed to use pastebin?)

Then lifecycle event listeners will be called multiple times for gadgets 
that need to be retried...
I'm a bit uneasy over this kind of magic...  I'm not sure what all the 
implications are on the rest of the container and CommonContainer code (or 
feature code similar to actions that does things with lifecycle 
listeners).

Any thoughts?
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message