Authored by 姜枫

修改重启时,没保存状态

@@ -12,6 +12,7 @@ import path from 'path'; @@ -12,6 +12,7 @@ import path from 'path';
12 import ws from '../../lib/ws'; 12 import ws from '../../lib/ws';
13 import { 13 import {
14 RestartInfo, 14 RestartInfo,
  15 + DeployInfo,
15 Server 16 Server
16 } from '../models'; 17 } from '../models';
17 18
@@ -23,8 +24,10 @@ class Restart { @@ -23,8 +24,10 @@ class Restart {
23 24
24 async restart(info) { 25 async restart(info) {
25 let server = await Server.findByHost(info.host); 26 let server = await Server.findByHost(info.host);
  27 +
26 this.server = server; 28 this.server = server;
27 this.info = info; 29 this.info = info;
  30 + this.id = await DeployInfo.insertOrUpdate(this.info);
28 this.sshRestart({ 31 this.sshRestart({
29 host: server.host, 32 host: server.host,
30 username: server.username, 33 username: server.username,
@@ -87,6 +90,7 @@ class Restart { @@ -87,6 +90,7 @@ class Restart {
87 state: state 90 state: state
88 }); 91 });
89 await RestartInfo.updateState(this.info._id, state); 92 await RestartInfo.updateState(this.info._id, state);
  93 + await DeployInfo.updateState(this.id, state);
90 } 94 }
91 95
92 _log(msg) { 96 _log(msg) {