Skip to content

Commit

Permalink
fix: opt pump cache, issue: TencentBlueKing#296
Browse files Browse the repository at this point in the history
  • Loading branch information
tbs60 committed Sep 11, 2024
1 parent e07fdb0 commit a9c6df4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"fmt"
"net"
"os"
"path/filepath"
"strings"
"syscall"

Expand Down Expand Up @@ -170,8 +171,10 @@ func calculateDependencies(fileDetails []*types.FilesDetails) [][]int {
// depend 检查 s1 是否依赖 s2
func depend(s1, s2 *types.FilesDetails) bool {
// 如果是s2是s1的子目录,则s1依赖s2
if len(s2.File.FilePath) < len(s1.File.FilePath) &&
strings.HasPrefix(s1.File.FilePath, s2.File.FilePath) {
dir1 := filepath.Dir(s1.File.FilePath)
dir2 := filepath.Dir(s2.File.FilePath)
if len(dir2) < len(dir1) &&
strings.HasPrefix(dir1, dir2) {
return true
}

Expand Down

0 comments on commit a9c6df4

Please sign in to comment.