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

fix(server): fixed the error of repeatedly deleting website routes #957

Merged
merged 1 commit into from
Mar 24, 2023

Conversation

maslow
Copy link
Member

@maslow maslow commented Mar 24, 2023

No description provided.

@maslow maslow merged commit 46d0cce into labring:main Mar 24, 2023
@@ -194,7 +194,6 @@ export class WebsiteTaskService {
// delete website route if exists
const route = await this.apisixService.getRoute(region, site._id.toString())
if (route) {
await this.apisixService.deleteWebsiteRoute(region, site)
const res = await this.apisixService.deleteWebsiteRoute(region, site)
this.logger.log(`delete website route: ${res?.key}`)
this.logger.debug('delete website route', res)
Copy link

Choose a reason for hiding this comment

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

by looking at the code.

The code is trying to delete a website route in the ApisixService. The code first checks if the route exists, and if it does, it attempts to delete it using the deleteWebsiteRoute method. The result of this operation is then logged.

It looks like there is a bug risk in this code. The code tries to delete the route even if it doesn't exist. This could lead to errors or unexpected behavior. To fix this, we can add a check to make sure the route exists before attempting to delete it.

In addition, it looks like the code is trying to log the result of the deletion operation. However, the code is not properly checking if the result is successful or not. To make sure that only successful deletions are logged, we can add a check to the logging code to ensure the result was successful before logging it.

@maslow maslow deleted the fix-website-delete-route branch March 24, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant