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

Allow specifying 'all' for process auto restarts #154

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

dunkmann00
Copy link
Contributor

@dunkmann00 dunkmann00 commented Apr 7, 2023

This closes #153

I ended up going with the suggestion for specifying that all processes should auto restart by passing in all, i.e. overmind start -r all rather than adding another flag that is specifically for auto restarting all, i.e. overmind start --auto-restart-all. I thought this was slightly more intuitive, especially since this is how setting formation is already handled.

Let me know what you think!

@dunkmann00 dunkmann00 changed the title Allow specifying 'all' for process restarts Allow specifying 'all' for process auto restarts Apr 8, 2023
@dunkmann00
Copy link
Contributor Author

Hey @DarthSim! If you have a chance could you look this over? Thanks!

@catpreneur
Copy link

catpreneur commented Aug 5, 2023

@dunkmann00 Thanks for this pr!

Look at line 96

(h.AnyCanDie || utils.StringsContain(canDie, e.OrigName)),

They use a boolean to indicate all can die, not all string. Maybe you should make it a boolean so it's consistent.

@dunkmann00
Copy link
Contributor Author

dunkmann00 commented Aug 5, 2023

Thanks @oofdog! Like I said in my initial comment of this PR, after seeing the suggestion in #153, I thought using all made more sense.

Just to add some more detail -
There is precedent for this in Overmind. Setting the number of instances of a process (formation) uses all as well.

From the Readme:

There is a special name all that you can use to scale all processes at once:

$ overmind start -m all=2,worker=5
$ OVERMIND_FORMATION=all=2,worker=5 overmind start

IMHO, I think changing can-die to support all (or any if preferable) would be better for consistency and simplicity.

P.S. Here is where formation is handled in the code:

num := 1
if fnum, ok := formation[name]; ok {
num = fnum
} else if fnum, ok := formation["all"]; ok {
num = fnum
}

@dunkmann00
Copy link
Contributor Author

Hey @DarthSim! Just wanted to reach out again and see if this PR looks good to you. Thanks!

Copy link
Collaborator

@Envek Envek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is elegant! @mrexox, wdyt?

Copy link
Collaborator

@mrexox mrexox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Envek , agree!

@Envek Envek merged commit 7f78ffd into DarthSim:master Sep 15, 2023
@dunkmann00
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-restart all processes?
4 participants