Allow to set preferred storage destination

This commit is contained in:
LittleSheep 2025-03-24 21:39:21 +08:00
parent cd7d19db68
commit 1a1b9eb556
2 changed files with 7 additions and 1 deletions

View File

@ -291,7 +291,11 @@ func AnalyzeAttachment(file models.Attachment) error {
if !linked {
go func() {
start = time.Now()
if err := ReUploadFile(file, 1); err != nil {
preferred := viper.GetInt("preferred_destination")
if preferred == 0 {
preferred = 1
}
if err := ReUploadFile(file, preferred); err != nil {
log.Warn().Any("file", file).Err(err).Msg("Unable to move file to permanet storage...")
} else {
// Recycle the temporary file

View File

@ -5,6 +5,8 @@ grpc_bind = "0.0.0.0:7004"
nexus_addr = "localhost:7001"
preferred_destination = 1
[workers]
files_deletion = 4
files_analyze = 4