Don't warn on no file in cache
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
@@ -121,8 +122,11 @@ func (db *DBWrapper) GetFile(filePath string) ([]byte, error) {
|
||||
var fileSnapshot FileSnapshot
|
||||
err := db.db.Model(&FileSnapshot{}).Where("file_path = ?", filePath).First(&fileSnapshot).Error
|
||||
if err != nil {
|
||||
// Downgrade not-found to warning to avoid noisy errors during first run
|
||||
getFileLogger.Warning("Failed to get file from database: %v", err)
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
getFileLogger.Debug("File not found in database: %v", err)
|
||||
} else {
|
||||
getFileLogger.Warning("Failed to get file from database: %v", err)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
getFileLogger.Debug("File found in database")
|
||||
|
Reference in New Issue
Block a user