1
0
mirror of synced 2026-04-27 10:48:41 +08:00

限定TopOverCostCount范围

This commit is contained in:
yitter
2022-07-16 00:42:36 +08:00
parent 519206cdbf
commit b1b3d0cd6d
12 changed files with 165 additions and 84 deletions

View File

@@ -4,6 +4,7 @@
* 代码修订yitter
* 开源地址https://github.com/yitter/idgenerator
*/
package idgen
import (
@@ -64,6 +65,11 @@ func NewDefaultIdGenerator(options *IdGeneratorOptions) *DefaultIdGenerator {
panic("MinSeqNumber error. (range:[5, " + strconv.FormatUint(uint64(maxSeqNumber), 10) + "]")
}
// 7.TopOverCostCount
if options.TopOverCostCount < 0 || options.TopOverCostCount > 10000 {
panic("TopOverCostCount error. (range:[0, 10000]")
}
var snowWorker ISnowWorker
switch options.Method {
case 1: