Make it more implementable

This commit is contained in:
2024-08-20 19:17:43 +08:00
parent 73b39a4fb5
commit 37c47f9839
6 changed files with 21 additions and 24 deletions

View File

@@ -99,6 +99,14 @@ func AnalyzeAttachment(file models.Attachment) error {
var start time.Time
if len(file.HashCode) == 0 {
if hash, err := HashAttachment(file); err != nil {
return err
} else {
file.HashCode = hash
}
}
// Do analyze jobs
if !file.IsAnalyzed || len(file.HashCode) == 0 {
destMap := viper.GetStringMap("destinations.temporary")
@@ -158,12 +166,6 @@ func AnalyzeAttachment(file models.Attachment) error {
"color_space": stream.ColorSpace,
}
}
if hash, err := HashAttachment(file); err != nil {
return err
} else {
file.HashCode = hash
}
}
tx := database.C.Begin()