-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
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
并行执行的代码BUG #146
Comments
应该要改成这样吧 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
并行执行部署时,协程未传参进去,导致所有协程执行的都是同一台机器。代码如下
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: