Skip to content

Commit

Permalink
feat: 代码调整#2837
Browse files Browse the repository at this point in the history
  • Loading branch information
zacYL committed Jan 2, 2025
1 parent 3503fca commit 22187f3
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ class BackupNodeDataHandler(
if (context.task.backupSetting.conflictStrategy == BackupConflictStrategy.SKIP) {
return
}
updateExistNode(record, collectionName)
try {
updateExistNode(record, collectionName)
} catch (e: DuplicateKeyException) {
updateDuplicateNode(record, collectionName)
}
} else {
try {
mongoTemplate.save(record, collectionName)
Expand Down Expand Up @@ -259,7 +263,7 @@ class BackupNodeDataHandler(
.set(NodeDetailInfo::md5.name, record.md5)
.set(NodeDetailInfo::size.name, record.size)
.set(NodeDetailInfo::id.name, record.id)
mongoTemplate.upsert(existNodeQuery, update, collectionName)
mongoTemplate.updateFirst(existNodeQuery, update, collectionName)
}

/**
Expand Down

0 comments on commit 22187f3

Please sign in to comment.