新增 NodeSubscriptionJob添加任务时去重

This commit is contained in:
小肥羊 2025-03-21 17:11:39 +08:00
parent 8847ae987b
commit 655ee7ea5f
2 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,7 @@ namespace Learn.VideoAnalysis.Expand
//每5分钟执行一次 未处理视频扫描 //每5分钟执行一次 未处理视频扫描
scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes(); scheduler.Schedule<NodeSubscriptionJob>().EveryFiveMinutes();
//文件包分析 //文件包分析
scheduler.Schedule<NodePackageJob>().HourlyAt(20); scheduler.Schedule<NodePackageJob>().HourlyAt(10);
//任务缓存清理 //任务缓存清理
// scheduler.Schedule<TaskFileClearJob>().HourlyAt(10); // scheduler.Schedule<TaskFileClearJob>().HourlyAt(10);
}); });

View File

@ -37,6 +37,7 @@ namespace VideoAnalysisCore.Job
{ {
Console.WriteLine($"{DateTime.Now} Invoke=>{this.GetType().FullName}"); Console.WriteLine($"{DateTime.Now} Invoke=>{this.GetType().FullName}");
var videoIdArr = videotaskDB.AsQueryable().Select(v => v.TagId).Distinct().ToArray();
var tasks = await nodesubscriptionDB.GetListAsync(s => s.Enable && s.Subject ==SubjectEnum.); var tasks = await nodesubscriptionDB.GetListAsync(s => s.Enable && s.Subject ==SubjectEnum.);
foreach (var item in tasks) foreach (var item in tasks)
{ {
@ -78,6 +79,8 @@ namespace VideoAnalysisCore.Job
var videos = new List<VideoTask>(data.Count); var videos = new List<VideoTask>(data.Count);
foreach (var s in data) foreach (var s in data)
{ {
if (videoIdArr.Contains(s.VideoCode))
continue;
videos.Add(new VideoTask() videos.Add(new VideoTask()
{ {
Id = YitIdHelper.NextId(), Id = YitIdHelper.NextId(),