From 949811c8f2b71584595f76f61c575845df2e67cd Mon Sep 17 00:00:00 2001 From: Brian Broll Date: Tue, 21 Jul 2020 13:28:32 -0500 Subject: [PATCH] Suboptimal workaround for forking when applying updates. (#1785) --- .../panels/Sidebar/SidebarPanel.js | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/visualizers/panels/Sidebar/SidebarPanel.js b/src/visualizers/panels/Sidebar/SidebarPanel.js index 2ca4ed924..b2e0d2034 100644 --- a/src/visualizers/panels/Sidebar/SidebarPanel.js +++ b/src/visualizers/panels/Sidebar/SidebarPanel.js @@ -3,6 +3,7 @@ define([ 'deepforge/updates/Updates', + 'deepforge/utils', 'js/Constants', 'js/PanelBase/PanelBase', 'panels/AutoViz/AutoVizPanel', @@ -11,6 +12,7 @@ define([ 'q' ], function ( Updates, + Utils, CONSTANTS, PanelBase, AutoVizPanel, @@ -164,15 +166,14 @@ define([ }); }; - SidebarPanel.prototype.applyUpdates = function (updates) { - // Seed Updates should apply the + SidebarPanel.prototype.applyUpdates = async function (updates) { const seedUpdates = updates.filter(update => update.type === Updates.SEED); - const promises = seedUpdates.map(update => { - const {name, hash} = update; - return Q.ninvoke(this._client, 'updateLibrary', name, hash); - }); + for (let i = 0; i < seedUpdates.length; i++) { + const {name, hash} = seedUpdates[i]; + await Q.ninvoke(this._client, 'updateLibrary', name, hash); + } - // Apply the migrations + await Utils.sleep(1000); const pluginId = 'ApplyUpdates'; const migrations = updates .filter(update => update.type === Updates.MIGRATION) @@ -183,11 +184,7 @@ define([ updates: migrations }; - promises.push( - Q.ninvoke(this._client, 'runServerPlugin', pluginId, context) - ); - - return Q.all(promises); + await Q.ninvoke(this._client, 'runServerPlugin', pluginId, context); }; return SidebarPanel;