← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1479162] Re: Need a way to batch async requests

 

** Changed in: horizon
       Status: In Progress => Won't Fix

** Changed in: horizon
    Milestone: liberty-rc1 => None

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1479162

Title:
  Need a way to batch async requests

Status in OpenStack Dashboard (Horizon):
  Won't Fix

Bug description:
  In order to make multiple async calls in javascript, we need to nest
  them. This makes the code unreadable at some point. There is a better
  way to batch multiple async calls using defer and promises. This patch
  provides a way to batch async calls and handle it once ALL async calls
  are complete.

  Nesting example
  -------------------------
    keystoneAPI.getRoles(function(roles) {
      keystoneAPI.getUsers(function(roles) {
        settingAPI.getSetting('SETTING', 'default').then(function(settings){
        // do something here
      });
    });

  Batch example
  ----------------------
    var async = {
      keystone: keystoneAPI.getRoles(),
      keystone: keystoneAPI.getUsers(),
      settings: settingAPI.getSetting('SETTING', 'default')
    };
    httpBatch.batch(async).then(function(response) {
      // do something here
    });

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1479162/+subscriptions


References