Skip to content

Commit

Permalink
fix: 增加ref对应的blob数量超过限制日志输出 #2181
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlkl committed Nov 15, 2024
1 parent 0ca5b97 commit fc6a73f
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import org.springframework.stereotype.Repository
@Repository
class BlobRefRepository : SimpleMongoDao<TDdcBlobRef>() {
fun addRefToBlob(projectId: String, repoName: String, bucket: String, refKey: String, blobIds: Set<String>) {
if (blobIds.size > DEFAULT_BLOB_SIZE_LIMIT) {
val ref = "$projectId/$repoName/${buildRef(bucket, refKey)}"
logger.error("blobs of ref[$ref] exceed size limit, size[${blobIds.size}]]")
}
blobIds.forEach {
try {
insert(
Expand All @@ -35,4 +39,8 @@ class BlobRefRepository : SimpleMongoDao<TDdcBlobRef>() {
.and(TDdcBlobRef::ref.name).isEqualTo(buildRef(bucket, refKey))
return determineMongoTemplate().findAllAndRemove(Query(criteria), TDdcBlobRef::class.java)
}

companion object {
private const val DEFAULT_BLOB_SIZE_LIMIT = 20
}
}

0 comments on commit fc6a73f

Please sign in to comment.