1
0
mirror of synced 2026-02-15 09:27:55 +08:00

auto commit

This commit is contained in:
yitter
2022-06-06 22:48:35 +08:00
parent 0e6fbe732f
commit 5e24340526
2 changed files with 10 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ namespace Yitter.OrgSystem.TestA
class Program
{
// 测试参数默认配置下最佳性能是10W/s
static int genIdCount = 2;//50000; // 计算ID数量如果要验证50W效率请将TopOverCostCount设置为20000或适当增加SeqBitLength
static int genIdCount = 2;//5000; // 计算ID数量如果要验证50W效率请将TopOverCostCount设置为20000或适当增加SeqBitLength
static short method = 1; // 1-漂移算法2-传统算法

View File

@@ -41,9 +41,15 @@ namespace Yitter.IdGenerator
{
if (_IdGenInstance == null)
{
_IdGenInstance = new DefaultIdGenerator(
new IdGeneratorOptions() { WorkerId = 0 }
);
lock (_IdGenInstance)
{
if (_IdGenInstance == null)
{
_IdGenInstance = new DefaultIdGenerator(
new IdGeneratorOptions() { WorkerId = 0 }
);
}
}
}
return _IdGenInstance.NewLong();