Authored by 姜枫

fix bug

@@ -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 = [];  
47 46
48 - deploy.target.forEach(async(host) => { 47 +
  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 - });  
55 - targets.push({ 54 + }).then((info) => {
  55 + return {
56 host: host, 56 host: host,
57 hostFm: host.replace(/\./g, '-'), 57 hostFm: host.replace(/\./g, '-'),
58 info: info 58 info: info
59 - }) 59 + };
60 }); 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', {