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

How do I delete a registered route? #979

Closed
springrain opened this issue Oct 24, 2023 · 7 comments
Closed

How do I delete a registered route? #979

springrain opened this issue Oct 24, 2023 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@springrain
Copy link
Contributor

Describe the Question

How do I delete a registered route?

Hertz version:

0.7.1

@li-jin-gou li-jin-gou added the question Further information is requested label Oct 24, 2023
@li-jin-gou
Copy link
Member

Deleting routes is not supported cc @Duslia

@li-jin-gou
Copy link
Member

I've seen gateways that just register the 404 handler route and then do simple route matching and handler reloading themselves.

@FGYFFFF
Copy link
Contributor

FGYFFFF commented Oct 24, 2023

Is it an idl-generated route?

@springrain
Copy link
Contributor Author

springrain commented Oct 24, 2023

Hertz loads routes provided by external modules (e.g. WASM), external modules update routes, there will be conflicts, hope to delete the old route, register a new route.
Or what should be the idea of a workaround to delete a route?

@springrain
Copy link
Contributor Author

springrain commented Oct 26, 2023

I modified the routergroup.go and tree.go implementation and I don't know if Hertz need this pr.
Specific references: https://gitee.com/gpress/hertz/commit/2e614725e31ca7491627270ce8f88b83cde0488b

@Duslia
Copy link
Member

Duslia commented Oct 26, 2023

Hertz was not originally designed to consider dynamic registration and deletion of routes, which requires locking to ensure. If dynamic routing is needed, one can use NoRoute and then implement the route matching method themselves.

@springrain
Copy link
Contributor Author

Ok, thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

4 participants