From ee97989e88a4bb0356fe3be8be17a47c221b7c0d Mon Sep 17 00:00:00 2001 From: yitter Date: Wed, 29 Sep 2021 14:08:01 +0800 Subject: [PATCH] auto commit --- C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs b/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs index ab450f1..4bb4d13 100644 --- a/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs +++ b/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs @@ -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