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

[#1368] add flag control graceful invalid call service-center api #1369

Merged
merged 4 commits into from
Aug 16, 2024

Conversation

chengyouling
Copy link
Collaborator

@chengyouling chengyouling commented Aug 15, 2024

servicecomb引擎场景:
1、由于spring加载bean是无序的,某些场景服务端口就绪了,但是微服务未注册,此时实例更新不成功。
2、上线脚本存在问题时,有可能多次请求更新实例状态为UP的情况,给服务端造成不必要的压力。
nacos场景:
上线脚本存在问题时,有可能多次请求更新实例状态为UP的情况,给服务端造成不必要的压力。

@chengyouling chengyouling self-assigned this Aug 15, 2024
serviceCombServiceRegistry.setStatus(serviceCombRegistration, status.toUpperCase());
if (isOperationAllow(status)) {
serviceCombServiceRegistry.setStatus(serviceCombRegistration, status.toUpperCase());
LOGGER.warn("servicecomb graceful update status success, status: " + status);
Copy link
Collaborator

Choose a reason for hiding this comment

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

这个是正常级别的日志,不是warn类型的日志

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

}
LOGGER.warn("operation is not allowed, status: " + status + ", registration_enabled: "
Copy link
Collaborator

Choose a reason for hiding this comment

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

用readiness修改状态实例状态为上线实现优雅上下线是推荐的方案之一,那这个操作就不是warn。改成info就可以了

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

LOGGER.warn("servicecomb graceful update status success, status: " + status);
return;
}
LOGGER.warn("operation is not allowed, status: " + status + ", instanceStatus: "
Copy link
Collaborator

Choose a reason for hiding this comment

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

同上面nacos的评论

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

}

private boolean isOperationAllow(String status) {
return (GovernanceProperties.GRASEFUL_STATUS_UPPER.equalsIgnoreCase(status)
Copy link
Collaborator

Choose a reason for hiding this comment

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

圈复杂度有点搞,可以改成以下格式:
if (xxx)
return true
if (xxx)
return true
return false

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

@chengyouling chengyouling merged commit 9c78c64 into huaweicloud:master Aug 16, 2024
1 check passed
@chengyouling chengyouling deleted the master-graceful branch August 20, 2024 01:56
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.

2 participants