Commit d924d038 by liimin

fix(UploadService): 添加黑名单检查防止重复上传失败文件

在文件上传前增加黑名单检查,避免因队列滞后导致重复上传已知失败的文件
同时优化录音管理模块的恢复逻辑和错误处理
1 parent af5ea84a
......@@ -306,6 +306,13 @@ class UploadService {
}
async uploadRecord(record) {
// 任务开始前,再次检查黑名单(防止队列滞后)
const taskKey = this._getTaskKey(record.recordId, record.fileName)
if (this._blackList.has(taskKey)) {
uni.$logger.local.warn(`【上传服务】 == 任务在黑名单中,跳过: ${taskKey}`)
this.endTask()
return
}
uni.$logger.local.info(`【上传服务】 == 开始上传文件!! record: ${JSON.stringify(record)}`)
if (record.status === FileStatus.NoFile || record.status === FileStatus.NotExist) {
uni.$logger.local.info(`【上传服务】 == 记录中有未上传文件,或文件不存在, 直接保存记录!!`)
......@@ -464,6 +471,7 @@ class UploadService {
if (!fileExists) {
this.reportError('【上传服务】 == 记录中有语音文件地址,但是文件不存在', { record: cur, file }, cur.id, file.file)
file2Up.status = FileStatus.NotExist
this._blackList.add(taskKey)
}
result.push(file2Up)
} catch (error) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!