diff options
Diffstat (limited to 'internal/db/bundb/media.go')
-rw-r--r-- | internal/db/bundb/media.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/db/bundb/media.go b/internal/db/bundb/media.go index ed41e7cd9..3c8ceaafc 100644 --- a/internal/db/bundb/media.go +++ b/internal/db/bundb/media.go @@ -54,7 +54,7 @@ func (m *mediaDB) GetAttachmentByID(ctx context.Context, id string) (*gtsmodel.M func (m *mediaDB) GetAttachmentsByIDs(ctx context.Context, ids []string) ([]*gtsmodel.MediaAttachment, error) { // Load all media IDs via cache loader callbacks. - media, err := m.state.Caches.GTS.Media.LoadIDs("ID", + media, err := m.state.Caches.DB.Media.LoadIDs("ID", ids, func(uncached []string) ([]*gtsmodel.MediaAttachment, error) { // Preallocate expected length of uncached media attachments. @@ -85,7 +85,7 @@ func (m *mediaDB) GetAttachmentsByIDs(ctx context.Context, ids []string) ([]*gts } func (m *mediaDB) getAttachment(ctx context.Context, lookup string, dbQuery func(*gtsmodel.MediaAttachment) error, keyParts ...any) (*gtsmodel.MediaAttachment, error) { - return m.state.Caches.GTS.Media.LoadOne(lookup, func() (*gtsmodel.MediaAttachment, error) { + return m.state.Caches.DB.Media.LoadOne(lookup, func() (*gtsmodel.MediaAttachment, error) { var attachment gtsmodel.MediaAttachment // Not cached! Perform database query @@ -98,7 +98,7 @@ func (m *mediaDB) getAttachment(ctx context.Context, lookup string, dbQuery func } func (m *mediaDB) PutAttachment(ctx context.Context, media *gtsmodel.MediaAttachment) error { - return m.state.Caches.GTS.Media.Store(media, func() error { + return m.state.Caches.DB.Media.Store(media, func() error { _, err := m.db.NewInsert().Model(media).Exec(ctx) return err }) @@ -111,7 +111,7 @@ func (m *mediaDB) UpdateAttachment(ctx context.Context, media *gtsmodel.MediaAtt columns = append(columns, "updated_at") } - return m.state.Caches.GTS.Media.Store(media, func() error { + return m.state.Caches.DB.Media.Store(media, func() error { _, err := m.db.NewUpdate(). Model(media). Where("? = ?", bun.Ident("media_attachment.id"), media.ID). @@ -135,7 +135,7 @@ func (m *mediaDB) DeleteAttachment(ctx context.Context, id string) error { } // On return, ensure that media with ID is invalidated. - defer m.state.Caches.GTS.Media.Invalidate("ID", id) + defer m.state.Caches.DB.Media.Invalidate("ID", id) // Delete media attachment in new transaction. err = m.db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { |