mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-28 07:03:32 -06:00
test the media manager a bit, add shutdown logic
This commit is contained in:
parent
0ef478584c
commit
e0f9323b9a
37 changed files with 688 additions and 354 deletions
|
|
@ -119,7 +119,7 @@ func (d *deref) GetRemoteAccount(ctx context.Context, username string, remoteAcc
|
|||
} else {
|
||||
// take the id we already have and do an update
|
||||
gtsAccount.ID = maybeAccount.ID
|
||||
|
||||
aaaaaaaaaaaaaaaaaa
|
||||
if err := d.PopulateAccountFields(ctx, gtsAccount, username, refresh); err != nil {
|
||||
return nil, new, fmt.Errorf("FullyDereferenceAccount: error populating further account fields: %s", err)
|
||||
}
|
||||
|
|
@ -260,7 +260,7 @@ func (d *deref) fetchHeaderAndAviForAccount(ctx context.Context, targetAccount *
|
|||
avatar := true
|
||||
processingMedia, err := d.mediaManager.ProcessMedia(ctx, data, targetAccount.ID, &media.AdditionalInfo{
|
||||
RemoteURL: &targetAccount.AvatarRemoteURL,
|
||||
Avatar: &avatar,
|
||||
Avatar: &avatar,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -283,7 +283,7 @@ func (d *deref) fetchHeaderAndAviForAccount(ctx context.Context, targetAccount *
|
|||
header := true
|
||||
processingMedia, err := d.mediaManager.ProcessMedia(ctx, data, targetAccount.ID, &media.AdditionalInfo{
|
||||
RemoteURL: &targetAccount.HeaderRemoteURL,
|
||||
Header: &header,
|
||||
Header: &header,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -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.AdditionalInfo) (*media.Media, error)
|
||||
GetRemoteMedia(ctx context.Context, requestingUsername string, accountID string, remoteURL string, ai *media.AdditionalInfo) (*media.Processing, error)
|
||||
|
||||
DereferenceAnnounce(ctx context.Context, announce *gtsmodel.Status, requestingUsername string) error
|
||||
DereferenceThread(ctx context.Context, username string, statusIRI *url.URL) error
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
"github.com/superseriousbusiness/gotosocial/internal/media"
|
||||
)
|
||||
|
||||
func (d *deref) GetRemoteMedia(ctx context.Context, requestingUsername string, accountID string, remoteURL string, ai *media.AdditionalInfo) (*media.Media, error) {
|
||||
func (d *deref) GetRemoteMedia(ctx context.Context, requestingUsername string, accountID string, remoteURL string, ai *media.AdditionalInfo) (*media.Processing, error) {
|
||||
if accountID == "" {
|
||||
return nil, fmt.Errorf("RefreshAttachment: minAttachment account ID was empty")
|
||||
}
|
||||
|
|
@ -46,10 +46,10 @@ func (d *deref) GetRemoteMedia(ctx context.Context, requestingUsername string, a
|
|||
return nil, fmt.Errorf("RefreshAttachment: error dereferencing media: %s", err)
|
||||
}
|
||||
|
||||
m, err := d.mediaManager.ProcessMedia(ctx, data, accountID, ai)
|
||||
processingMedia, err := d.mediaManager.ProcessMedia(ctx, data, accountID, ai)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("RefreshAttachment: error processing attachment: %s", err)
|
||||
}
|
||||
|
||||
return m, nil
|
||||
return processingMedia, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ func (suite *AttachmentTestSuite) TestDereferenceAttachmentBlocking() {
|
|||
})
|
||||
suite.NoError(err)
|
||||
|
||||
// make a blocking call to load the attachment from the in-process media
|
||||
attachment, err := media.LoadAttachment(ctx)
|
||||
// make a blocking call to load the attachment from the in-process media
|
||||
attachment, err := media.Load(ctx)
|
||||
suite.NoError(err)
|
||||
|
||||
suite.NotNil(attachment)
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ func (d *deref) populateStatusAttachments(ctx context.Context, status *gtsmodel.
|
|||
continue
|
||||
}
|
||||
|
||||
attachment, err := media.LoadAttachment(ctx)
|
||||
attachment, err := media.Load(ctx)
|
||||
if err != nil {
|
||||
logrus.Errorf("populateStatusAttachments: couldn't load remote attachment %s: %s", a.RemoteURL, err)
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue