fix:修复hangfire的redisKey前缀增加:号,并设置终止态任务只保留1小时

This commit is contained in:
hardstylewyl 2025-03-25 17:11:10 +08:00
parent 84edc5644e
commit cfccd59ce1

View File

@ -221,12 +221,13 @@ public class SjzyTrackApplicationModule : AbpModule
context.Services.Configure<TrackWarningTaskOptions>(configuration.GetSection("WarningTask")); context.Services.Configure<TrackWarningTaskOptions>(configuration.GetSection("WarningTask"));
context.Services.AddHangfire(o => context.Services.AddHangfire(o =>
{ {
var options = new RedisStorageOptions() var options = new RedisStorageOptions
{ {
Prefix = GlobalConst.TrackHangfireKeyPrefix, Prefix = $"{GlobalConst.TrackHangfireKeyPrefix}:",
Db = int.Parse(configuration["Redis:Database"]!), Db = int.Parse(configuration["Redis:Database"]!),
}; };
o.UseRedisStorage(connectionString,options); o.UseRedisStorage(connectionString, options)
.WithJobExpirationTimeout(TimeSpan.FromHours(1)); // 终止态任务只保留1小时
}); });
context.Services.AddHangfireServer(o => context.Services.AddHangfireServer(o =>
{ {