🐛 Fix uploader still using old cache api
This commit is contained in:
parent
fea0664d62
commit
10eb0ba3bc
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@ -4,9 +4,10 @@
|
||||
<option name="autoReloadType" value="ALL" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix analyzer didn't cache attachment">
|
||||
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix direct upload will save as non-uploaded">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/up_direct_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/up_direct_api.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/attachments.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/attachments.go" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/uploader.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/uploader.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -117,7 +118,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value=":arrow_up: Upgrade Passport to fix bug" />
|
||||
<MESSAGE value=":ambulance: Fix getting user panic" />
|
||||
<MESSAGE value=":zap: Add cache into metadata fetching" />
|
||||
<MESSAGE value=":recycle: Moved onto dealer" />
|
||||
@ -142,7 +142,8 @@
|
||||
<MESSAGE value=":sparkles: Make it more implementable" />
|
||||
<MESSAGE value=":bug: Fix merged file isn't add to cache" />
|
||||
<MESSAGE value=":bug: Fix analyzer didn't cache attachment" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix analyzer didn't cache attachment" />
|
||||
<MESSAGE value=":bug: Fix direct upload will save as non-uploaded" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix direct upload will save as non-uploaded" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<settings-migrated>true</settings-migrated>
|
||||
|
@ -31,7 +31,6 @@ func GetAttachmentByID(id uint) (models.Attachment, error) {
|
||||
}).Preload("Pool").Preload("Account").First(&attachment).Error; err != nil {
|
||||
return attachment, err
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
CacheAttachment(attachment)
|
||||
}
|
||||
|
||||
@ -49,7 +48,6 @@ func GetAttachmentByRID(rid string) (models.Attachment, error) {
|
||||
}).Preload("Pool").Preload("Account").First(&attachment).Error; err != nil {
|
||||
return attachment, err
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
CacheAttachment(attachment)
|
||||
}
|
||||
|
||||
@ -74,6 +72,7 @@ func GetAttachmentCache(id any) (models.Attachment, bool) {
|
||||
}
|
||||
|
||||
func CacheAttachment(item models.Attachment) {
|
||||
MaintainAttachmentCache()
|
||||
metadataCache.Store(item.Rid, item)
|
||||
}
|
||||
|
||||
@ -110,7 +109,6 @@ func NewAttachmentMetadata(tx *gorm.DB, user models.Account, file *multipart.Fil
|
||||
if err := tx.Save(&attachment).Error; err != nil {
|
||||
return attachment, fmt.Errorf("failed to save attachment record: %v", err)
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
CacheAttachment(attachment)
|
||||
}
|
||||
|
||||
@ -142,7 +140,6 @@ func NewAttachmentPlaceholder(tx *gorm.DB, user models.Account, attachment model
|
||||
if err := tx.Save(&attachment).Error; err != nil {
|
||||
return attachment, fmt.Errorf("failed to save attachment record: %v", err)
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
CacheAttachment(attachment)
|
||||
}
|
||||
|
||||
@ -189,7 +186,6 @@ func UpdateAttachment(item models.Attachment) (models.Attachment, error) {
|
||||
if err := database.C.Updates(&item).Error; err != nil {
|
||||
return item, err
|
||||
} else {
|
||||
MaintainAttachmentCache()
|
||||
CacheAttachment(item)
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ func ReUploadFileToPermanent(meta models.Attachment) error {
|
||||
}
|
||||
|
||||
database.C.Save(&meta)
|
||||
metadataCache.Store(meta.ID, meta)
|
||||
CacheAttachment(meta)
|
||||
return nil
|
||||
case models.DestinationTypeS3:
|
||||
var destConfigured models.S3Destination
|
||||
@ -137,7 +137,7 @@ func ReUploadFileToPermanent(meta models.Attachment) error {
|
||||
}
|
||||
|
||||
database.C.Save(&meta)
|
||||
metadataCache.Store(meta.ID, meta)
|
||||
CacheAttachment(meta)
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("invalid destination: unsupported protocol %s", dest.Type)
|
||||
|
Loading…
Reference in New Issue
Block a user