forked from free-lancers/electricity_bill_calc_service
fix(serial):修正雪花ID生成算法中不能保存最后序列号的问题。
This commit is contained in:
@@ -32,7 +32,7 @@ func init() {
|
|||||||
if timestamp != lastTimestamp {
|
if timestamp != lastTimestamp {
|
||||||
lastSerial = 0
|
lastSerial = 0
|
||||||
}
|
}
|
||||||
lastSerial := lastSerial + 1
|
lastSerial = lastSerial + 1
|
||||||
uniqueId := generateSerial(timestamp, lastSerial)
|
uniqueId := generateSerial(timestamp, lastSerial)
|
||||||
SerialResponseChan <- uniqueId
|
SerialResponseChan <- uniqueId
|
||||||
lastTimestamp = timestamp
|
lastTimestamp = timestamp
|
||||||
@@ -42,7 +42,7 @@ func init() {
|
|||||||
if timestamp != lastTimestamp {
|
if timestamp != lastTimestamp {
|
||||||
lastSerial = 0
|
lastSerial = 0
|
||||||
}
|
}
|
||||||
lastSerial := lastSerial + 1
|
lastSerial = lastSerial + 1
|
||||||
uniqueId := generateStringSerial(timestamp, lastSerial)
|
uniqueId := generateStringSerial(timestamp, lastSerial)
|
||||||
StringSerialResponseChan <- uniqueId
|
StringSerialResponseChan <- uniqueId
|
||||||
lastTimestamp = timestamp
|
lastTimestamp = timestamp
|
||||||
|
Reference in New Issue
Block a user