Skip to content

Commit

Permalink
refactor(core): remove unused condition in Scheduler
Browse files Browse the repository at this point in the history
THe Promise should always be returned by the provider.

BREAKING CHANGE: a Provider needs to return a Promise every time after
calling its executeCommand function.
  • Loading branch information
zarov authored and peppsac committed Apr 16, 2018
1 parent e0d839d commit 43b76ef
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Core/Scheduler/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ function _instanciateQueue() {
this.counters.executing++;
}

// If the provider returns a Promise, use it to handle counters
// Otherwise use a resolved Promise.
var p = provider.executeCommand(cmd) || Promise.resolve();

return p.then((result) => {
return provider.executeCommand(cmd).then((result) => {
this.counters.executing--;
cmd.resolve(result);
// only count successul commands
Expand Down Expand Up @@ -202,10 +198,6 @@ Scheduler.prototype.resetCommandsCount = function resetCommandsCount(type) {
return sum;
};

Scheduler.prototype.getProviders = function getProviders() {
return this.providers.slice();
};

Scheduler.prototype.deQueue = function deQueue(queue) {
var st = queue.storage;
while (st.length > 0) {
Expand Down

0 comments on commit 43b76ef

Please sign in to comment.