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

Run forever supports not exit progam #154

Open
vicanso opened this issue Mar 24, 2024 · 3 comments
Open

Run forever supports not exit progam #154

vicanso opened this issue Mar 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@vicanso
Copy link

vicanso commented Mar 24, 2024

What is the problem your feature solves, or the need it fulfills?

I use pingora as a lib for my reverse proxy , but run_forever function will call std::process::exit(0);. I expect close the http server only, but not exit the program,.

Describe the solution you'd like

Support parameter to set not exit the program for run_forever function.

@vicanso vicanso changed the title Run forever support not exit process Run forever supports not exit progam Mar 24, 2024
@andrewhavck andrewhavck added the enhancement New feature or request label Mar 25, 2024
@vicanso
Copy link
Author

vicanso commented Mar 30, 2024

I want to use pingora as a reverse proxy module, I don't want to restart the program by way to load the new configuration. So I just need to close server1 and run server2, which as follows:

  1. Server1 is running
  2. Server2 trying to receive socks
  3. Server1sending socks and close all runtimes
  4. Server2 run all services

Is it feasible?

@eaufavor
Copy link
Member

That should be possible. That is how internally we do the graceful restart. But the code is coupled with signal handling for now. Maybe someone can refactor that code to decouple them.

@futurist
Copy link

Also want run_forever return a anyhow::Result<()> instead of block_on(self.main_loop()), which will be panic when tokio::spawn, with below error:

Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.

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

No branches or pull requests

4 participants