We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
并行执行部署时,协程未传参进去,导致所有协程执行的都是同一台机器。代码如下
func (d *Deploy) Parallel() { if d.status == STATUS_FAILED { return } d.status = STATUS_ING status := STATUS_DONE for _, srv := range d.srvs { d.wg.Add(1) go func() { if d.status == STATUS_ING { srv.Deploy() if srv.Result().Status == STATUS_FAILED { status = STATUS_FAILED } } defer d.wg.Done() }() } d.wg.Wait() d.status = status }
The text was updated successfully, but these errors were encountered:
for _, srv := range d.srvs { d.wg.Add(1) go func(srv *Server) { if d.status == STATUS_ING { srv.Deploy() if srv.Result().Status == STATUS_FAILED { status = STATUS_FAILED } } defer d.wg.Done() }(srv) }
应该要改成这样吧
Sorry, something went wrong.
No branches or pull requests
并行执行部署时,协程未传参进去,导致所有协程执行的都是同一台机器。代码如下
func (d *Deploy) Parallel() {
if d.status == STATUS_FAILED {
return
}
d.status = STATUS_ING
status := STATUS_DONE
for _, srv := range d.srvs {
d.wg.Add(1)
go func() {
if d.status == STATUS_ING {
srv.Deploy()
if srv.Result().Status == STATUS_FAILED {
status = STATUS_FAILED
}
}
defer d.wg.Done()
}()
}
d.wg.Wait()
d.status = status
}
The text was updated successfully, but these errors were encountered: