You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/03/11 08:00:59 UTC
[GitHub] [shardingsphere] menghaoranss commented on a change in pull request #15991: Refresh status for compute nodes when when instance enabled or disabled
menghaoranss commented on a change in pull request #15991:
URL: https://github.com/apache/shardingsphere/pull/15991#discussion_r824469775
##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/instance/InstanceContext.java
##########
@@ -51,23 +50,26 @@
public InstanceContext(final ComputeNodeInstance instance, final WorkerIdGenerator workerIdGenerator, final ModeConfiguration modeConfiguration) {
this.instance = instance;
- switchInstanceState(instance.getStatus());
this.workerIdGenerator = workerIdGenerator;
this.modeConfiguration = modeConfiguration;
}
/**
* Update instance status.
- *
+ *
+ * @param instanceId instance id
* @param status collection of status
*/
- public void updateInstanceStatus(final Collection<String> status) {
- instance.setStatus(status);
- switchInstanceState(status);
- }
-
- private void switchInstanceState(final Collection<String> status) {
- state.switchState(StateType.CIRCUIT_BREAK, null != status && status.contains(StateType.CIRCUIT_BREAK.name()));
+ public void updateInstanceStatus(final String instanceId, final Collection<String> status) {
+ if (instance.getInstanceDefinition().getInstanceId().getId().equals(instanceId)) {
+ instance.switchState(status);
Review comment:
if the instanceId from event not equals current instanceId, should refresh the computeNodeInstances too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org