Skip to content

Commit 1fa8d4c

Browse files
authored
Using EnvironmentVariableTarget.Machine to get the environment variables. (#1220)
EnvironmentVariableTarget.Machine The environment variable is stored or retrieved from the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment key in the Windows operating system registry. This value should be used on .NET implementations running on Windows systems only. https://learn.microsoft.com/en-us/dotnet/api/system.environmentvariabletarget?view=net-6.0
1 parent 702afed commit 1fa8d4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/DotNetCore.CAP/Internal/SnowflakeId.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static SnowflakeId Default()
8787
return _snowflakeId;
8888
}
8989

90-
if (!long.TryParse(Environment.GetEnvironmentVariable("CAP_WORKERID", EnvironmentVariableTarget.Machine), out var workerId))
90+
if (!long.TryParse(Environment.GetEnvironmentVariable("CAP_WORKERID"), out var workerId))
9191
{
9292
workerId = Util.GenerateWorkerId(MaxWorkerId);
9393
}
@@ -188,4 +188,4 @@ private static long GenerateRandomWorkerId(int maxWorkerId)
188188
return new Random().Next(maxWorkerId + 1);
189189
}
190190
}
191-
}
191+
}

0 commit comments

Comments
 (0)