限定TopOverCostCount范围
This commit is contained in:
@@ -63,7 +63,6 @@ namespace Yitter.IdGenerator
|
||||
/// </summary>
|
||||
public virtual int TopOverCostCount { get; set; } = 2000;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数据中心ID(默认0)
|
||||
/// </summary>
|
||||
|
||||
@@ -118,10 +118,10 @@ namespace Yitter.IdGenerator
|
||||
|
||||
// 7.Others
|
||||
TopOverCostCount = options.TopOverCostCount;
|
||||
if (TopOverCostCount == 0)
|
||||
{
|
||||
TopOverCostCount = 2000;
|
||||
}
|
||||
//if (TopOverCostCount == 0)
|
||||
//{
|
||||
// TopOverCostCount = 2000;
|
||||
//}
|
||||
|
||||
_TimestampShift = (byte)(WorkerIdBitLength + SeqBitLength);
|
||||
_CurrentSeqNumber = options.MinSeqNumber;
|
||||
|
||||
@@ -92,6 +92,12 @@ namespace Yitter.IdGenerator
|
||||
throw new ApplicationException("MinSeqNumber error. (range:[5, " + maxSeqNumber + "]");
|
||||
}
|
||||
|
||||
// 7.TopOverCostCount
|
||||
if (options.TopOverCostCount < 0 || options.TopOverCostCount > 10000)
|
||||
{
|
||||
throw new ApplicationException("TopOverCostCount error. (range:[0, 10000]");
|
||||
}
|
||||
|
||||
switch (options.Method)
|
||||
{
|
||||
case 2:
|
||||
|
||||
Reference in New Issue
Block a user