[ISSUE-#4467] Fix snowflake id problem (#4468)

* fix snowflake id problem

* revert code format
This commit is contained in:
赵延 2020-12-15 12:56:05 +08:00 committed by GitHub
parent ec99590500
commit 2546f052e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -810,8 +810,13 @@ public class ServiceManager implements RecordListener<Service> {
if (UtilsAndCommons.UPDATE_INSTANCE_ACTION_REMOVE.equals(action)) {
instanceMap.remove(instance.getDatumKey());
} else {
Instance oldInstance = instanceMap.get(instance.getDatumKey());
if (oldInstance != null) {
instance.setInstanceId(oldInstance.getInstanceId());
} else {
instance.setInstanceId(instance.generateInstanceId(currentInstanceIds));
}
instanceMap.put(instance.getDatumKey(), instance);
}