Skip to content

Commit 6412546

Browse files
committed
Fix multi threading issue with get all keys
1 parent fb893be commit 6412546

4 files changed

Lines changed: 21 additions & 4 deletions

File tree

CondenserDotNet.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Release Notes", "Release No
8686
releasenotes\4.1.0.props = releasenotes\4.1.0.props
8787
releasenotes\4.1.1.props = releasenotes\4.1.1.props
8888
releasenotes\4.1.10.props = releasenotes\4.1.10.props
89+
releasenotes\4.1.11.props = releasenotes\4.1.11.props
8990
releasenotes\4.1.3.props = releasenotes\4.1.3.props
9091
releasenotes\4.1.4.props = releasenotes\4.1.4.props
9192
releasenotes\4.1.9.props = releasenotes\4.1.9.props

releasenotes/4.1.11.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Project>
2+
<PropertyGroup>
3+
<PackageReleaseNotes>
4+
* Fix multi threading issue with "get all keys"
5+
</PackageReleaseNotes>
6+
</PropertyGroup>
7+
</Project>

src/CondenserDotNet.Configuration/Consul/ConsulRegistry.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,24 @@ public ConsulRegistry(IOptions<ConsulRegistryConfig> agentConfig, ILoggerFactory
3030
}
3131

3232
public ConsulRegistry(ILoggerFactory loggerFactory = null, Core.Consul.IConsulAclProvider aclProvider = null)
33-
:this(null, loggerFactory, aclProvider)
33+
: this(null, loggerFactory, aclProvider)
3434
{
35-
35+
3636
}
3737

3838
/// <summary>
3939
/// This returns a flattened list of all the loaded keys
4040
/// </summary>
41-
public IEnumerable<string> AllKeys => _configKeys.SelectMany(x => x.Keys);
41+
public IEnumerable<string> AllKeys
42+
{
43+
get
44+
{
45+
lock (_configKeys)
46+
{
47+
return _configKeys.SelectMany(x => x.Keys).ToArray();
48+
}
49+
}
50+
}
4251
public IConfigSource ConfigSource => _source;
4352
public IConfigurationRoot Root => _root ?? (_root = _builder.Build());
4453
public ConfigurationBuilder Builder => _builder;

version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>4.1.10</VersionPrefix>
3+
<VersionPrefix>4.1.11</VersionPrefix>
44
<VersionSuffix>beta</VersionSuffix>
55
</PropertyGroup>
66
</Project>

0 commit comments

Comments
 (0)