修复 部分单例应用写入数据库时未能COPY NEW的问题导致的写入失败

This commit is contained in:
小肥羊 2026-02-09 17:13:50 +08:00
parent 53951aa870
commit dac6eee091
3 changed files with 7 additions and 6 deletions

View File

@ -173,7 +173,7 @@ namespace VideoAnalysisCore.AICore.GPT.DeepSeek
|| s.Depth == 2))
.Select(s => s.Name).ToArrayAsync();
var captionsArr = JsonSerializer.Deserialize<SenseVoiceRes[]>(taskInfo.Captions);
var fileNameResFormat = "{授课章节: string|null}";
var rCaptionArr = string.Join(',', captionsArr
.Where((s, i) => i % 3 == 0)

View File

@ -133,7 +133,7 @@ namespace VideoAnalysisCore.Common
{
var taskId = long.Parse(task);
//获取资源文件 地址
var taskInfo = await videoTaskDB.AsQueryable()
var taskInfo = await videoTaskDB.CopyNew().AsQueryable()
.Where(s => s.Id == taskId).FirstAsync();
if (taskInfo is null )
throw new Exception($"任务为null/是教研视频/没有视频课程名称");
@ -176,7 +176,7 @@ namespace VideoAnalysisCore.Common
var outputPath = Path.Combine(localPath, taskVideoName);
if (!Directory.Exists(localPath)) Directory.CreateDirectory(localPath);
await videoTaskDB
await videoTaskDB.CopyNew()
.AsUpdateable()
.SetColumns(it => it.LocalMediaPath == outputPath)
.Where(it => it.Id == long.Parse(task))
@ -190,7 +190,7 @@ namespace VideoAnalysisCore.Common
.Select(s => s.VideoUrl)
.FirstAsync();
if (!string.IsNullOrEmpty(taskInfo.PPTVideoUrl))
await videoTaskDB.AsUpdateable(taskInfo)
await videoTaskDB.CopyNew().AsUpdateable(taskInfo)
.UpdateColumns(it => new { it.PPTVideoUrl })
.ExecuteCommandAsync();

View File

@ -247,7 +247,7 @@ namespace VideoAnalysisCore.Common
try
{
var insertData = Redis.LRange<TaskLog>(RedisExpandKey.TaskLog, 0, count -1);
taskLogDB.AsInsertable(insertData).ExecuteCommand();
taskLogDB.CopyNew().AsInsertable(insertData).ExecuteCommand();
//同步删除redis
Redis.LTrim(RedisExpandKey.TaskLog, count, 1000);
}
@ -386,6 +386,7 @@ namespace VideoAnalysisCore.Common
//删除任务执行状态
await Redis.LRemAsync(RedisExpandKey.IDTask, 1, task);
var taskData = await videoTaskDB
.CopyNew()
.GetFirstAsync(s => s.Id == tId);
if (taskData.Captions == "[]")
taskData.Captions = (await Redis.HMGetAsync(RedisExpandKey.Task(task), "Captions")).First();
@ -399,7 +400,7 @@ namespace VideoAnalysisCore.Common
taskData.ErrorMessage = string.Empty;
taskData.LastEnum = RedisChannelEnum.;
taskData.EndTime = DateTime.Now;
await videoTaskDB.AsUpdateable(taskData)
await videoTaskDB.CopyNew().AsUpdateable(taskData)
.UpdateColumns(it => new
{
//it.ChatAnalysis,