1
0
mirror of synced 2026-04-18 22:38:41 +08:00

auto commit

This commit is contained in:
yitter
2021-09-29 14:08:01 +08:00
parent 1e2cd11be2
commit ee97989e88

View File

@@ -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("errorDataCenterIdBitLength + WorkerIdBitLength + SeqBitLength <= 22");
throw new ApplicationException("errorDataCenterIdBitLength + WorkerIdBitLength + SeqBitLength <= " + maxLength);
}
// 3.WorkerId & DataCenterId