mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add parallel operation support for pause/unpause
Support parallel pause/unpause Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
2155b46915
commit
f1dda4395e
2 changed files with 4 additions and 2 deletions
|
@ -34,8 +34,9 @@ func runPause(dockerCli *command.DockerCli, opts *pauseOptions) error {
|
|||
ctx := context.Background()
|
||||
|
||||
var errs []string
|
||||
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerPause)
|
||||
for _, container := range opts.containers {
|
||||
if err := dockerCli.Client().ContainerPause(ctx, container); err != nil {
|
||||
if err := <-errChan; err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
} else {
|
||||
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
|
||||
|
|
|
@ -35,8 +35,9 @@ func runUnpause(dockerCli *command.DockerCli, opts *unpauseOptions) error {
|
|||
ctx := context.Background()
|
||||
|
||||
var errs []string
|
||||
errChan := parallelOperation(ctx, opts.containers, dockerCli.Client().ContainerUnpause)
|
||||
for _, container := range opts.containers {
|
||||
if err := dockerCli.Client().ContainerUnpause(ctx, container); err != nil {
|
||||
if err := <-errChan; err != nil {
|
||||
errs = append(errs, err.Error())
|
||||
} else {
|
||||
fmt.Fprintf(dockerCli.Out(), "%s\n", container)
|
||||
|
|
Loading…
Reference in a new issue