🐛 Fix analyzer didn't cache attachment

This commit is contained in:
LittleSheep 2024-08-21 10:51:11 +08:00
parent 479b1933b0
commit 1e4d7985ea
2 changed files with 4 additions and 8 deletions

View File

@ -4,11 +4,7 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":sparkles: Make it more implementable"> <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix merged file isn't add to cache" />
<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_multipart_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/up_multipart_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/merger.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/merger.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -118,7 +114,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="&#10;:sparkles: Add health check" />
<MESSAGE value=":arrow_up: Upgrade Passport and use Hyper SDK" /> <MESSAGE value=":arrow_up: Upgrade Passport and use Hyper SDK" />
<MESSAGE value=":arrow_up: Upgrade Passport to fix bug" /> <MESSAGE value=":arrow_up: Upgrade Passport to fix bug" />
<MESSAGE value=":ambulance: Fix getting user panic" /> <MESSAGE value=":ambulance: Fix getting user panic" />
@ -143,7 +138,8 @@
<MESSAGE value=":sparkles: Un-public indexable &amp; select by pools" /> <MESSAGE value=":sparkles: Un-public indexable &amp; select by pools" />
<MESSAGE value=":sparkles: Multipart file upload" /> <MESSAGE value=":sparkles: Multipart file upload" />
<MESSAGE value=":sparkles: Make it more implementable" /> <MESSAGE value=":sparkles: Make it more implementable" />
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Make it more implementable" /> <MESSAGE value=":bug: Fix merged file isn't add to cache" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix merged file isn't add to cache" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -181,7 +181,7 @@ func AnalyzeAttachment(file models.Attachment) error {
if linked && err != nil { if linked && err != nil {
return fmt.Errorf("unable to link file record: %v", err) return fmt.Errorf("unable to link file record: %v", err)
} else if !linked { } else if !linked {
metadataCache.Store(file.ID, file) CacheAttachment(file)
if err := tx.Save(&file).Error; err != nil { if err := tx.Save(&file).Error; err != nil {
tx.Rollback() tx.Rollback()
return fmt.Errorf("unable to save file record: %v", err) return fmt.Errorf("unable to save file record: %v", err)