提交 ee97989e 编写于 作者: yitter's avatar yitter

auto commit

上级 1e2cd11b
......@@ -42,13 +42,14 @@ namespace Yitter.IdGenerator
}
// 2.WorkerIdBitLength
int maxLength = options.TimestampType == 0 ? 22 : 31; // (秒级时间戳时放大到31位)
if (options.WorkerIdBitLength <= 0)
{
throw new ApplicationException("WorkerIdBitLength error.(range:[1, 21])");
}
if (options.DataCenterIdBitLength + options.WorkerIdBitLength + options.SeqBitLength > 22)
if (options.DataCenterIdBitLength + options.WorkerIdBitLength + options.SeqBitLength > maxLength)
{
throw new ApplicationException("error:DataCenterIdBitLength + WorkerIdBitLength + SeqBitLength <= 22");
throw new ApplicationException("error:DataCenterIdBitLength + WorkerIdBitLength + SeqBitLength <= " + maxLength);
}
// 3.WorkerId & DataCenterId
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册