Skip to content

Commit

Permalink
v1.6.5 - 增加 Register 方法可选参数 idle;
Browse files Browse the repository at this point in the history
  • Loading branch information
2881099 committed Mar 29, 2023
1 parent e133d87 commit 06e363c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/FreeSql.Cloud/FreeSql.Cloud.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard20;net40</TargetFrameworks>
<Version>1.6.4</Version>
<Version>1.6.5</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>FreeSql;ncc;YeXiangQin</Authors>
<Description>提供跨数据库访问,分布式事务TCC、SAGA解决方案,支持 .NET Core 2.1+, .NET Framework 4.0+.</Description>
Expand All @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="FreeSql.DbContext" Version="3.2.666" />
<PackageReference Include="FreeScheduler" Version="1.0.9" />
<PackageReference Include="FreeScheduler" Version="1.1.0" />
<PackageReference Include="IdleBus" Version="1.5.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions src/FreeSql.Cloud/FreeSqlCloud.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ internal IFreeSql GetBySnapshot(TDBKey dbkey)

public bool RemoveRegister(TDBKey dbkey) => _ib.TryRemove(dbkey, false);
public bool ExistsRegister(TDBKey dbkey) => _ib.Exists(dbkey);
public FreeSqlCloud<TDBKey> Register(TDBKey dbkey, Func<IFreeSql> create)
public FreeSqlCloud<TDBKey> Register(TDBKey dbkey, Func<IFreeSql> create, TimeSpan? idle = null)
{
if (_ib.TryRegister(dbkey, create))
if (idle == null || idle <= TimeSpan.Zero) idle = TimeSpan.FromMinutes(3);
if (_ib.TryRegister(dbkey, create, idle.Value))
{
if (!string.IsNullOrWhiteSpace(DistributeKey))
{
Expand Down

0 comments on commit 06e363c

Please sign in to comment.