✨ Make it more implementable
This commit is contained in:
@ -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()
|
||||
|
@ -44,5 +44,7 @@ func MergeFileChunks(meta models.Attachment, arrange []string) (models.Attachmen
|
||||
meta.IsUploaded = true
|
||||
database.C.Save(&meta)
|
||||
|
||||
PublishAnalyzeTask(meta)
|
||||
|
||||
return meta, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user