I have the following HTTP request handled in my node server. I have to send a list of disks back as a response.
The code is:
DiskPromise.getDiskCount(client).then(function (diskCount) { DiskPromise.getDisks(client, diskCount).then(function (disks) { RaidPromise.getRaidCount(client).then(function (raidCount) { RaidPromise.getRaidArrays(client, raidCount).then(function (raidArrays) { for (i in disks) { disks[i].setRaidInfo(raidArrays); } RaidPromise.getGlobalSpareList(client).then (function(spareNames) { for (i in disks) { disks[i].setSpareNess(spareNames); } res.json(disks); }, function (err) { console.log("something (either getDiskCount, or one of the getDisk calls) blew up", err); res.send(403, { error: err.toString() }); }); }); }); }); });
the promises are SOAP calls. It takes anywhere from 4.5 to 7.0 seconds for the client to get a response back.
Am I doing something structurally wrong laying out the code?