优化迁移Host,移除一些不必要的组件
This commit is contained in:
parent
469ea285f2
commit
76019141f1
@ -1,7 +1,4 @@
|
|||||||
//using Hangfire;
|
using JiShe.CollectBus.Migration.Host.HealthChecks;
|
||||||
//using Hangfire.Redis.StackExchange;
|
|
||||||
using JiShe.CollectBus.Migration.Host.Hangfire;
|
|
||||||
using JiShe.CollectBus.Migration.Host.HealthChecks;
|
|
||||||
using JiShe.CollectBus.Migration.Host.Swaggers;
|
using JiShe.CollectBus.Migration.Host.Swaggers;
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
using Microsoft.AspNetCore.DataProtection;
|
||||||
@ -12,7 +9,6 @@ using StackExchange.Redis;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Volo.Abp.AspNetCore.Auditing;
|
using Volo.Abp.AspNetCore.Auditing;
|
||||||
using Volo.Abp.Auditing;
|
using Volo.Abp.Auditing;
|
||||||
using Volo.Abp.BackgroundJobs;
|
|
||||||
using Volo.Abp.Caching;
|
using Volo.Abp.Caching;
|
||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
|
|
||||||
@ -21,33 +17,6 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
{
|
{
|
||||||
public partial class CollectBusMigrationHostModule
|
public partial class CollectBusMigrationHostModule
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Configures the hangfire.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="context">The context.</param>
|
|
||||||
//private void ConfigureHangfire(ServiceConfigurationContext context)
|
|
||||||
//{
|
|
||||||
// var redisStorageOptions = new RedisStorageOptions()
|
|
||||||
// {
|
|
||||||
// Db = context.Services.GetConfiguration().GetValue<int>("Redis:HangfireDB")
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
|
||||||
|
|
||||||
// context.Services.AddHangfire(config =>
|
|
||||||
// {
|
|
||||||
// config.UseRedisStorage(
|
|
||||||
// context.Services.GetConfiguration().GetValue<string>("Redis:Configuration"), redisStorageOptions)
|
|
||||||
// .WithJobExpirationTimeout(TimeSpan.FromDays(7));
|
|
||||||
// var delaysInSeconds = new[] { 10, 60, 60 * 3 }; // 重试时间间隔
|
|
||||||
// const int Attempts = 3; // 重试次数
|
|
||||||
// config.UseFilter(new AutomaticRetryAttribute() { Attempts = Attempts, DelaysInSeconds = delaysInSeconds });
|
|
||||||
// //config.UseFilter(new AutoDeleteAfterSuccessAttribute(TimeSpan.FromDays(7)));
|
|
||||||
// config.UseFilter(new JobRetryLastFilter(Attempts));
|
|
||||||
// });
|
|
||||||
// context.Services.AddHangfireServer();
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Configures the JWT authentication.
|
/// Configures the JWT authentication.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -179,8 +148,8 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
(
|
(
|
||||||
options =>
|
options =>
|
||||||
{
|
{
|
||||||
options.IsEnabled = true;
|
options.IsEnabled = false;
|
||||||
options.EntityHistorySelectors.AddAllEntities();
|
//options.EntityHistorySelectors.AddAllEntities();
|
||||||
options.ApplicationName = "JiShe.CollectBus.Migration";
|
options.ApplicationName = "JiShe.CollectBus.Migration";
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -86,7 +86,7 @@ namespace JiShe.CollectBus.Migration.Host
|
|||||||
}
|
}
|
||||||
//app.UseAuditing();
|
//app.UseAuditing();
|
||||||
app.UseAbpSerilogEnrichers();
|
app.UseAbpSerilogEnrichers();
|
||||||
app.UseUnitOfWork();
|
//app.UseUnitOfWork();
|
||||||
//app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
//app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
||||||
//{
|
//{
|
||||||
// IgnoreAntiforgeryToken = true
|
// IgnoreAntiforgeryToken = true
|
||||||
|
|||||||
@ -1,29 +0,0 @@
|
|||||||
using Hangfire.Common;
|
|
||||||
using Hangfire.States;
|
|
||||||
using Serilog;
|
|
||||||
|
|
||||||
namespace JiShe.CollectBus.Migration.Host.Hangfire
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 重试最后一次
|
|
||||||
/// </summary>
|
|
||||||
public class JobRetryLastFilter : JobFilterAttribute, IElectStateFilter
|
|
||||||
{
|
|
||||||
private int RetryCount { get; }
|
|
||||||
|
|
||||||
public JobRetryLastFilter(int retryCount)
|
|
||||||
{
|
|
||||||
RetryCount = retryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void OnStateElection(ElectStateContext context)
|
|
||||||
{
|
|
||||||
var retryAttempt = context.GetJobParameter<int>("RetryCount");
|
|
||||||
if (RetryCount == retryAttempt)
|
|
||||||
{
|
|
||||||
Log.Error("最后一次重试");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -46,6 +46,8 @@
|
|||||||
<!--<PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" />-->
|
<!--<PackageReference Include="Volo.Abp.BackgroundWorkers.Hangfire" Version="8.3.3" />-->
|
||||||
|
|
||||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.3.3" />
|
||||||
|
|
||||||
|
<PackageReference Include="Volo.Abp.Core" Version="8.3.3" />
|
||||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.3" />
|
<PackageReference Include="Volo.Abp.Swashbuckle" Version="8.3.3" />
|
||||||
<!--<PackageReference Include="Hangfire.HttpJob" Version="3.8.5" />
|
<!--<PackageReference Include="Hangfire.HttpJob" Version="3.8.5" />
|
||||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user