修复 注入仓储仓时导致数据库连接被占用问题
This commit is contained in:
parent
d25fa4bcff
commit
7c0e39a43e
|
|
@ -19,6 +19,7 @@ namespace Learn.VideoAnalysis.Expand
|
|||
Console.WriteLine($"{DateTime.Now}=>初始化 Coravel");
|
||||
service.AddScheduler();
|
||||
service.AddTransient<NodeSubscriptionJob>();
|
||||
service.AddTransient<TaskFileClearJob>();
|
||||
}
|
||||
public static void UseCoravelExpand(this IServiceProvider provider)
|
||||
{
|
||||
|
|
@ -27,7 +28,7 @@ namespace Learn.VideoAnalysis.Expand
|
|||
//每5分钟执行一次 未处理视频扫描
|
||||
scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes();
|
||||
//每天两点
|
||||
scheduler.Schedule<TaskFileClearJob>().DailyAtHour(2);
|
||||
scheduler.Schedule<TaskFileClearJob>().HourlyAt(10);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ namespace Learn.VideoAnalysis.Expand
|
|||
public static void AddSqlSugarExpand(this IServiceCollection services)
|
||||
{
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
Console.WriteLine($"{DateTime.Now}=>初始化 YitId雪花ID");
|
||||
var options = new IdGeneratorOptions(ushort.Parse(AppCommon.Config.ID));
|
||||
YitIdHelper.SetIdGenerator(options);
|
||||
|
|
@ -42,7 +43,7 @@ namespace Learn.VideoAnalysis.Expand
|
|||
DbType = s.SqlType,
|
||||
IsAutoCloseConnection = true
|
||||
}));
|
||||
services.AddSingleton(typeof(Repository<>));
|
||||
services.AddTransient(typeof(Repository<>));
|
||||
|
||||
//注入SqlSugar 主库
|
||||
services.AddSqlSugar(dbList);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ namespace Learn.VideoAnalysis
|
|||
.AddInteractiveServerComponents();
|
||||
//.AddInteractiveWebAssemblyComponents();
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
builder.Services.AddLogging(loggingBuilder =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ namespace VideoAnalysisCore.Common
|
|||
return;
|
||||
}
|
||||
var c = t.GetCustomAttribute<TenantAttribute>();
|
||||
if (!CID.ContainsKey(typeof(T)))
|
||||
CID.Add(typeof(T), c?.configId);
|
||||
if (!CID.ContainsKey(t))
|
||||
CID.Add(t, c?.configId);
|
||||
base.Context = c != null
|
||||
? DbScoped.Sugar.GetConnectionScope(c.configId)
|
||||
: DbScoped.Sugar;
|
||||
|
|
|
|||
Loading…
Reference in New Issue