menghaoranss commented on a change in pull request #14824:
URL: https://github.com/apache/shardingsphere/pull/14824#discussion_r785789484
##########
File path:
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
##########
@@ -96,13 +96,15 @@
@Override
public void init() {
- workerId = getWorkerId();
maxVibrationOffset = getMaxVibrationOffset();
maxTolerateTimeDifferenceMilliseconds =
getMaxTolerateTimeDifferenceMilliseconds();
}
private long getWorkerId() {
- long result = Long.parseLong(props.getOrDefault(WORKER_ID_KEY,
WORKER_ID).toString());
+ if (null == instanceContext) {
+ return DEFAULT_WORKER_ID;
+ }
+ long result = instanceContext.getWorkerId();
Review comment:
BTW, thanks for you review
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]