1 | const restart = require('./restart')
|
2 |
|
3 | module.exports = function restartAll(config, command) {
|
4 | const q = []
|
5 |
|
6 | config.apps.forEach(app => {
|
7 | const cmd = Object.assign({}, command, {
|
8 | app: app.name
|
9 | })
|
10 |
|
11 | q.push(restart(config, cmd))
|
12 | })
|
13 |
|
14 | return Promise.all(q).then(stats => {
|
15 | return stats.reduce((a, b) => {
|
16 | a.started += b.started
|
17 | a.killed += b.killed
|
18 | return a
|
19 | }, {
|
20 | started: 0,
|
21 | killed: 0
|
22 | })
|
23 | })
|
24 | }
|