Skip to content

Allow specifying 'all' for process auto restarts - #154

Merged
Envek merged 2 commits into
DarthSim:masterfrom
dunkmann00:restart-all
Sep 15, 2023
Merged

Envek merged 2 commits into
DarthSim:masterfrom
dunkmann00:restart-all

Conversation

@dunkmann00

@dunkmann00 dunkmann00 commented Apr 7, 2023 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

@catpreneur

catpreneur commented Aug 5, 2023 •

Copy link
Copy Markdown

@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

dunkmann00 commented Aug 5, 2023 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

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

@Envek Envek left a comment

Copy link
Copy Markdown
Collaborator

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?

@mrexox mrexox left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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