mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-14 02:27:28 -06:00
[chore] Fixes + updates in emoji dereferencing logic (#1022)
* fix incorrect static remote url use for emojis * warn when emoji/attachment already exists * defer emoji postdata execution * rename ctx to innerCtx for clarity * warn on emoji too large * small efficiency fix in fetchRemoteAccountEmojis * tidy up lock+load * lock processing emojis * fix little fucky wucky * this wasn't go fmted for some reason
This commit is contained in:
parent
edcee14d07
commit
6fb47651c8
8 changed files with 191 additions and 75 deletions
|
|
@ -41,7 +41,7 @@ type Dereferencer interface {
|
|||
GetRemoteInstance(ctx context.Context, username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error)
|
||||
|
||||
GetRemoteMedia(ctx context.Context, requestingUsername string, accountID string, remoteURL string, ai *media.AdditionalMediaInfo) (*media.ProcessingMedia, error)
|
||||
GetRemoteEmoji(ctx context.Context, requestingUsername string, remoteURL string, shortcode string, id string, emojiURI string, ai *media.AdditionalEmojiInfo, refresh bool) (*media.ProcessingEmoji, error)
|
||||
GetRemoteEmoji(ctx context.Context, requestingUsername string, remoteURL string, shortcode string, domain string, id string, emojiURI string, ai *media.AdditionalEmojiInfo, refresh bool) (*media.ProcessingEmoji, error)
|
||||
|
||||
DereferenceAnnounce(ctx context.Context, announce *gtsmodel.Status, requestingUsername string) error
|
||||
DereferenceThread(ctx context.Context, username string, statusIRI *url.URL, status *gtsmodel.Status, statusable ap.Statusable)
|
||||
|
|
@ -58,6 +58,8 @@ type deref struct {
|
|||
dereferencingAvatarsLock *sync.Mutex
|
||||
dereferencingHeaders map[string]*media.ProcessingMedia
|
||||
dereferencingHeadersLock *sync.Mutex
|
||||
dereferencingEmojis map[string]*media.ProcessingEmoji
|
||||
dereferencingEmojisLock *sync.Mutex
|
||||
handshakes map[string][]*url.URL
|
||||
handshakeSync *sync.Mutex // mutex to lock/unlock when checking or updating the handshakes map
|
||||
}
|
||||
|
|
@ -73,6 +75,8 @@ func NewDereferencer(db db.DB, typeConverter typeutils.TypeConverter, transportC
|
|||
dereferencingAvatarsLock: &sync.Mutex{},
|
||||
dereferencingHeaders: make(map[string]*media.ProcessingMedia),
|
||||
dereferencingHeadersLock: &sync.Mutex{},
|
||||
dereferencingEmojis: make(map[string]*media.ProcessingEmoji),
|
||||
dereferencingEmojisLock: &sync.Mutex{},
|
||||
handshakeSync: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue