修复 部分单例应用写入数据库时未能COPY NEW的问题导致的写入失败
This commit is contained in:
parent
53951aa870
commit
dac6eee091
|
|
@ -133,7 +133,7 @@ namespace VideoAnalysisCore.Common
|
||||||
{
|
{
|
||||||
var taskId = long.Parse(task);
|
var taskId = long.Parse(task);
|
||||||
//获取资源文件 地址
|
//获取资源文件 地址
|
||||||
var taskInfo = await videoTaskDB.AsQueryable()
|
var taskInfo = await videoTaskDB.CopyNew().AsQueryable()
|
||||||
.Where(s => s.Id == taskId).FirstAsync();
|
.Where(s => s.Id == taskId).FirstAsync();
|
||||||
if (taskInfo is null )
|
if (taskInfo is null )
|
||||||
throw new Exception($"任务为null/是教研视频/没有视频课程名称");
|
throw new Exception($"任务为null/是教研视频/没有视频课程名称");
|
||||||
|
|
@ -176,7 +176,7 @@ namespace VideoAnalysisCore.Common
|
||||||
var outputPath = Path.Combine(localPath, taskVideoName);
|
var outputPath = Path.Combine(localPath, taskVideoName);
|
||||||
if (!Directory.Exists(localPath)) Directory.CreateDirectory(localPath);
|
if (!Directory.Exists(localPath)) Directory.CreateDirectory(localPath);
|
||||||
|
|
||||||
await videoTaskDB
|
await videoTaskDB.CopyNew()
|
||||||
.AsUpdateable()
|
.AsUpdateable()
|
||||||
.SetColumns(it => it.LocalMediaPath == outputPath)
|
.SetColumns(it => it.LocalMediaPath == outputPath)
|
||||||
.Where(it => it.Id == long.Parse(task))
|
.Where(it => it.Id == long.Parse(task))
|
||||||
|
|
@ -190,7 +190,7 @@ namespace VideoAnalysisCore.Common
|
||||||
.Select(s => s.VideoUrl)
|
.Select(s => s.VideoUrl)
|
||||||
.FirstAsync();
|
.FirstAsync();
|
||||||
if (!string.IsNullOrEmpty(taskInfo.PPTVideoUrl))
|
if (!string.IsNullOrEmpty(taskInfo.PPTVideoUrl))
|
||||||
await videoTaskDB.AsUpdateable(taskInfo)
|
await videoTaskDB.CopyNew().AsUpdateable(taskInfo)
|
||||||
.UpdateColumns(it => new { it.PPTVideoUrl })
|
.UpdateColumns(it => new { it.PPTVideoUrl })
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ namespace VideoAnalysisCore.Common
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var insertData = Redis.LRange<TaskLog>(RedisExpandKey.TaskLog, 0, count -1);
|
var insertData = Redis.LRange<TaskLog>(RedisExpandKey.TaskLog, 0, count -1);
|
||||||
taskLogDB.AsInsertable(insertData).ExecuteCommand();
|
taskLogDB.CopyNew().AsInsertable(insertData).ExecuteCommand();
|
||||||
//同步删除redis
|
//同步删除redis
|
||||||
Redis.LTrim(RedisExpandKey.TaskLog, count, 1000);
|
Redis.LTrim(RedisExpandKey.TaskLog, count, 1000);
|
||||||
}
|
}
|
||||||
|
|
@ -386,6 +386,7 @@ namespace VideoAnalysisCore.Common
|
||||||
//删除任务执行状态
|
//删除任务执行状态
|
||||||
await Redis.LRemAsync(RedisExpandKey.IDTask, 1, task);
|
await Redis.LRemAsync(RedisExpandKey.IDTask, 1, task);
|
||||||
var taskData = await videoTaskDB
|
var taskData = await videoTaskDB
|
||||||
|
.CopyNew()
|
||||||
.GetFirstAsync(s => s.Id == tId);
|
.GetFirstAsync(s => s.Id == tId);
|
||||||
if (taskData.Captions == "[]")
|
if (taskData.Captions == "[]")
|
||||||
taskData.Captions = (await Redis.HMGetAsync(RedisExpandKey.Task(task), "Captions")).First();
|
taskData.Captions = (await Redis.HMGetAsync(RedisExpandKey.Task(task), "Captions")).First();
|
||||||
|
|
@ -399,7 +400,7 @@ namespace VideoAnalysisCore.Common
|
||||||
taskData.ErrorMessage = string.Empty;
|
taskData.ErrorMessage = string.Empty;
|
||||||
taskData.LastEnum = RedisChannelEnum.结束任务;
|
taskData.LastEnum = RedisChannelEnum.结束任务;
|
||||||
taskData.EndTime = DateTime.Now;
|
taskData.EndTime = DateTime.Now;
|
||||||
await videoTaskDB.AsUpdateable(taskData)
|
await videoTaskDB.CopyNew().AsUpdateable(taskData)
|
||||||
.UpdateColumns(it => new
|
.UpdateColumns(it => new
|
||||||
{
|
{
|
||||||
//it.ChatAnalysis,
|
//it.ChatAnalysis,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue