Skip to content

Commit

Permalink
limit to single flow at a time
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejzasada committed Jul 19, 2017
1 parent 6a1dc44 commit c93a0bf
Show file tree
Hide file tree
Showing 3 changed files with 276 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/flowchat.js
Expand Up @@ -210,9 +210,12 @@ export class Flowchat {
const activationPromises = this._activators.map(activator => activator(data, state, sessionId));
return Promise.all(activationPromises)
.then(toActivate => {
const activeIndices = toActivate
let activeIndices = toActivate
.map((activate, index) => activate ? index : undefined)
.filter(index => index !== undefined);

// TODO: for now have only one flow active at a time
activeIndices = activeIndices.length === 0 ? [] : [activeIndices[0]];

if (activeIndices.length === 0) {
this._run('*', data, state, sessionId);
Expand Down
272 changes: 271 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c93a0bf

Please sign in to comment.