Skip to content
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

Re-Add WaitAllStoppedTimeout using WaitAllStopped, but deprecate it #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions service.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ func (c *Container) WaitAllStopped(ctx context.Context) {
}
}

// WaitAllStoppedTimeout waits x seconds or until all services are stopped. Services might still run after the call! Call Container.StopAll() to stop them.
// Deprecated: WaitAllStopped is the preferred method of Waiting for all stopped containers, it can take a context with a deadline/timeout for the same functionality.
func (c *Container) WaitAllStoppedTimeout(timeout time.Duration) {
var ctx context.Context
var cancel context.CancelFunc
if timeout != 0 {
ctx, cancel = context.WithTimeout(context.Background(), timeout)
} else {
ctx, cancel = context.WithCancel(context.Background())
}
defer cancel()
c.WaitAllStopped(ctx)
}

// ServiceErrors returns all errors occurred in services
func (c *Container) ServiceErrors() map[string]error {
errs := map[string]error{}
Expand Down
Loading