-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add container stopping and stopped hooks #1610
Conversation
Add pre-stop and post-stop hooks to the GenericContainer. This provides symmetry to the equavilent starting/started hooks and allows custom behvaior to be defined in sub-classes.
Hi @jalaziz, Could you please briefly explain why you need them? |
@bsideup I was extending one of the built-in Postgres container to provide a couple DB resources. I wanted a simple way to cleanup those resources before the container is terminated. I was able to accomplish what I needed by overriding Looking at the other containers, it seems that overriding |
@jalaziz the question is more like.... why do you need to cleanup a container that is going to be killed and forcibly removed? |
@bsideup Not cleaning up the container, cleaning up resources. To be more specific, our container sub-class creates a scheduler and provides a Slick database instance based on the container. We want to close those resources when the container stops. We're not trying to actually manipulate the container, we just want to manage resources alongside the lifecycle of the container in the same rule that starts/stops the container. |
I think this sounds reasonable. |
@jalaziz I see. Ok, let's add it 👍 |
Will do. Been a bit busy but will get to it as soon as I can. |
@jalaziz that would be great, thanks! |
@jalaziz I added the warnings myself, will be released very soon, thanks for your contribution 👍 |
Thanks @bsideup! |
Add pre-stop and post-stop hooks to the GenericContainer. This provides
symmetry to the equavilent starting/started hooks and allows custom
behvaior to be defined in sub-classes.