Skip to content

Commit

Permalink
fix: double dispose (#68)
Browse files Browse the repository at this point in the history
* fix: double dispose

* fix(sec): bump Caching.Memory
  • Loading branch information
mvarendorff2 authored Oct 22, 2024
1 parent 2d85ca2 commit 00f2967
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Fluss.Regen/Fluss.Regen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.10.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Fluss/Fluss.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Collections.Pooled" Version="1.0.82" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
Expand Down
6 changes: 4 additions & 2 deletions src/Fluss/UnitOfWork/UnitOfWorkFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public async ValueTask Commit(Func<IWriteUnitOfWork, ValueTask> action)
await RetryPolicy
.ExecuteAsync(async () =>
{
using var unitOfWork = serviceProvider.GetRequiredService<UnitOfWork>();
using var scope = serviceProvider.CreateScope();
var unitOfWork = scope.ServiceProvider.GetRequiredService<UnitOfWork>();
await action(unitOfWork);
await unitOfWork.CommitInternal();
});
Expand All @@ -36,7 +37,8 @@ public async ValueTask<T> Commit<T>(Func<IWriteUnitOfWork, ValueTask<T>> action)
return await RetryPolicy
.ExecuteAsync(async () =>
{
using var unitOfWork = serviceProvider.GetRequiredService<UnitOfWork>();
using var scope = serviceProvider.CreateScope();
var unitOfWork = scope.ServiceProvider.GetRequiredService<UnitOfWork>();
var result = await action(unitOfWork);
await unitOfWork.CommitInternal();
return result;
Expand Down

0 comments on commit 00f2967

Please sign in to comment.