Skip to content

Commit

Permalink
Suboptimal workaround for forking when applying updates. (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb authored Jul 21, 2020
1 parent 3b93adb commit 949811c
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/visualizers/panels/Sidebar/SidebarPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

define([
'deepforge/updates/Updates',
'deepforge/utils',
'js/Constants',
'js/PanelBase/PanelBase',
'panels/AutoViz/AutoVizPanel',
Expand All @@ -11,6 +12,7 @@ define([
'q'
], function (
Updates,
Utils,
CONSTANTS,
PanelBase,
AutoVizPanel,
Expand Down Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 949811c

Please sign in to comment.