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

autorestart - more forgiving restart logic #144

Open
jjanyan opened this issue Jul 1, 2024 · 1 comment
Open

autorestart - more forgiving restart logic #144

jjanyan opened this issue Jul 1, 2024 · 1 comment

Comments

@jjanyan
Copy link

jjanyan commented Jul 1, 2024

Currently if autorestart is set:

  1. app runs
  2. you have an error/typo in your code and hit save
  3. the app dies
  4. mprocs restarts
  5. it likely dies again (depending on where your mistake was)
  6. you now have to manually start the application once you've fixed your mistake

Can we consider a more forgiving workflow for this?

An option is a new config. Something like "unlimited-restart", default false. If set to true, it would restart continually.

Is there a concern for getting into a tight restart loop? I assume that is why this 1 second limit was put into place.

For my use case, I'm fine with accepting the tight restart loop. It matches behavior for similar tools.

If we're trying to exceed those tools, another optional "max-backoff" could be useful. 1ms -> 2ms -> 4... $maxBackoff. If you're worried about a tight loop you can set that value to something like 5 minutes.

Maybe another approach?

@pvolok
Copy link
Owner

pvolok commented Jul 2, 2024

The autorestart option definitely needs a lot of work. I would like to make mprocs also suitable for running apps in production. For that we need to understand common practicies that people are using.

autorestart: true should give you some convenient starting point for dev workflow. And then autorestart should accept an object for fine tuning this behavior.

Current 1 second limit is very arbitrary. I think it's better to have a growing interval between restarts, but current architecture doesn't allow this kind of behavior to be easily implemented.

I will collect examples in this issue of how other tools (kubernetes, systemd, pm2, etc) deal with this, so that we can have it as flexible as possible but also provide a good default.

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

No branches or pull requests

2 participants