Skip to content

daemon: use context.WithoutCancel in more places#46687

Merged
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:more_nocancel
Oct 20, 2023
Merged

daemon: use context.WithoutCancel in more places#46687
thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah:more_nocancel

Conversation

@thaJeztah
Copy link
Copy Markdown
Member

daemon: daemon.containerStop: use context.WithoutCancel

Follow-up to fc94ed0 (#45738). Now that
f6e44bc (#46552) added the compatcontext
package, we can start using context.WithoutCancel.

daemon: daemon.shutdownContainer: use context.WithoutCancel

Use context.WithoutCancel so that both the containerStop and
container.Wait can share the same parent context. This context is still
a "TODO", but can be wired up in future.

It's worth noting that daemon.containerStop already uses context.WithoutCancel,
so in that function, we'll be wrapping the context twice, but this should
likely not cause issues (just redundant for this code-path).

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Follow-up to fc94ed0. Now that
f6e44bc added the compatcontext
package, we can start using context.WithoutCancel.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Use context.WithoutCancel so that both the containerStop and
container.Wait can share the same parent context. This context is still
a "TODO", but can be wired up in future.

It's worth noting that daemon.containerStop already uses context.WithoutCancel,
so in that function, we'll be wrapping the context twice, but this should
likely not cause issues (just redundant for this code-path).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah added status/2-code-review area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code labels Oct 20, 2023
@thaJeztah
Copy link
Copy Markdown
Member Author

LOL, looks like I forgot updating the PR title from the "github generated one" to be something more meaningful; let me do so.

@thaJeztah thaJeztah changed the title More nocancel daemon: use contextWithoutCancel in more places Oct 20, 2023
@thaJeztah thaJeztah changed the title daemon: use contextWithoutCancel in more places daemon: use context.WithoutCancel in more places Oct 20, 2023
@thaJeztah thaJeztah added this to the 25.0.0 milestone Oct 20, 2023
@thaJeztah thaJeztah merged commit 164167e into moby:master Oct 20, 2023
@thaJeztah thaJeztah deleted the more_nocancel branch October 21, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants