Skip to content

Commit

Permalink
dispose CancellationTokenSource and publish v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
li-zheng-hao committed Nov 29, 2024
1 parent e205e80 commit 07b6103
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/LightMQ.OpenTelemetry/LightMQ.OpenTelemetry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<Version>2.1.0-preview2</Version>
<Version>2.1.1</Version>
<Title>LightMQ.OpenTelemetry</Title>
<Authors>lizhenghao</Authors>
<PackageProjectUrl>https://github.com/li-zheng-hao/LightMQ</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/LightMQ.Storage.MongoDB/LightMQ.Storage.MongoDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<Version>2.1.0-preview2</Version>
<Version>2.1.1</Version>
<Title>LightMQ.Storage.MongoDB</Title>
<Authors>lizhenghao</Authors>
<PackageProjectUrl>https://github.com/li-zheng-hao/LightMQ</PackageProjectUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<Version>2.1.0-preview2</Version>
<Version>2.1.1</Version>
<Title>LightMQ.Storage.SqlServer</Title>
<Authors>lizhenghao</Authors>
<PackageProjectUrl>https://github.com/li-zheng-hao/LightMQ</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion src/LightMQ.Storage.Sqlite/LightMQ.Storage.Sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<Version>2.1.0-preview2</Version>
<Version>2.1.1</Version>
<Title>LightMQ.Storage.Sqlite</Title>
<Authors>lizhenghao</Authors>
<PackageProjectUrl>https://github.com/li-zheng-hao/LightMQ</PackageProjectUrl>
Expand Down
15 changes: 9 additions & 6 deletions src/LightMQ/DispatcherService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace LightMQ;

public class DispatcherService :IHostedService
public class DispatcherService : IHostedService
{
private readonly ILogger<DispatcherService> _logger;
private readonly IServiceProvider _serviceProvider;
Expand Down Expand Up @@ -40,11 +40,11 @@ IEnumerable<IBackgroundService> backgroundServices
}

/// <summary>
///
///
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public Task StartAsync(CancellationToken cancellationToken)
public Task StartAsync(CancellationToken cancellationToken)
{
return Run(cancellationToken);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public async Task StopAsync(CancellationToken cancellationToken)

try
{
var tokenSource = new CancellationTokenSource();
using var tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(_options.Value.ExitTimeOut);
while (true)
{
Expand All @@ -134,8 +134,11 @@ public async Task StopAsync(CancellationToken cancellationToken)
{
_logger.LogInformation("LightMQ等待退出超时,强制退出");
}
finally
{
_cancel.Dispose();
}

_logger.LogInformation("LightMQ服务停止");
}

}
}
2 changes: 1 addition & 1 deletion src/LightMQ/LightMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IncludeSymbols>true</IncludeSymbols>
<Version>2.1.0-preview2</Version>
<Version>2.1.1</Version>
<Title>LightMQ</Title>
<Authors>lizhenghao</Authors>
<PackageProjectUrl>https://github.com/li-zheng-hao/LightMQ</PackageProjectUrl>
Expand Down

0 comments on commit 07b6103

Please sign in to comment.