🐛 Fix crash on maintain cache

This commit is contained in:
LittleSheep 2024-08-18 22:45:35 +08:00
parent d2ff4087e5
commit 02f6ad9020
2 changed files with 6 additions and 5 deletions

View File

@ -4,9 +4,9 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":boom: Replace attachment id by rid when fetching">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":boom: Use attachment rid instead of primary key when create">
<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/stickers_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/stickers_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" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -136,7 +136,8 @@
<MESSAGE value=":bug: Fix mark clean required issue" />
<MESSAGE value=":sparkles: Support use rid to get file" />
<MESSAGE value=":boom: Replace attachment id by rid when fetching" />
<option name="LAST_COMMIT_MESSAGE" value=":boom: Replace attachment id by rid when fetching" />
<MESSAGE value=":boom: Use attachment rid instead of primary key when create" />
<option name="LAST_COMMIT_MESSAGE" value=":boom: Use attachment rid instead of primary key when create" />
</component>
<component name="VgoProject">
<settings-migrated>true</settings-migrated>

View File

@ -197,9 +197,9 @@ func DeleteAttachment(item models.Attachment) error {
}
func MaintainAttachmentCache() {
var keySet []uint
var keySet []any
metadataCache.Range(func(k any, v any) bool {
keySet = append(keySet, k.(uint))
keySet = append(keySet, k)
return true
})
if len(keySet) > metadataCacheLimit {