Showing
1 changed file
with
10 additions
and
9 deletions
@@ -43,22 +43,23 @@ const p = { | @@ -43,22 +43,23 @@ const p = { | ||
43 | let deploy = project.deploy[env]; | 43 | let deploy = project.deploy[env]; |
44 | deploy.env = env; | 44 | deploy.env = env; |
45 | deploy.name = envs[env]; | 45 | deploy.name = envs[env]; |
46 | - let targets = []; | 46 | + |
47 | 47 | ||
48 | - deploy.target.forEach(async(host) => { | 48 | + let promises = deploy.target.map( (host) => { |
49 | console.log('read host :' + host); | 49 | console.log('read host :' + host); |
50 | - let info = await DeployInfo.findOne({ | 50 | + return await DeployInfo.findOne({ |
51 | projectId: project._id, | 51 | projectId: project._id, |
52 | host: host, | 52 | host: host, |
53 | env: env | 53 | env: env |
54 | + }).then((info) => { | ||
55 | + return { | ||
56 | + host: host, | ||
57 | + hostFm: host.replace(/\./g, '-'), | ||
58 | + info: info | ||
59 | + }; | ||
54 | }); | 60 | }); |
55 | - targets.push({ | ||
56 | - host: host, | ||
57 | - hostFm: host.replace(/\./g, '-'), | ||
58 | - info: info | ||
59 | - }) | ||
60 | }); | 61 | }); |
61 | - | 62 | + let targets = await Promise.all(promises); |
62 | console.log('targets: ', targets); | 63 | console.log('targets: ', targets); |
63 | 64 | ||
64 | await ctx.render('action/project_index', { | 65 | await ctx.render('action/project_index', { |
-
Please register or login to post a comment