From 5faeb4de2032e112ab49751eeeb906ac43826f3d Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Sun, 28 May 2023 13:08:35 +0100 Subject: [chore] tidy up media manager, add calling func to errors, build-script improvements (#1835) * media manager tidy-up: de-interface and remove unused PostDataFunc Signed-off-by: kim * remove last traces of media.Manager being an interface Signed-off-by: kim * update error to provide caller, allow tuneable via build tags Signed-off-by: kim * remove kim-specific build script changes Signed-off-by: kim * fix merge conflicts Signed-off-by: kim * update build-script to support externally setting build variables Signed-off-by: kim --------- Signed-off-by: kim --- internal/media/processingmedia.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'internal/media/processingmedia.go') diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go index fc75c3136..5c66f561d 100644 --- a/internal/media/processingmedia.go +++ b/internal/media/processingmedia.go @@ -40,12 +40,11 @@ import ( type ProcessingMedia struct { media *gtsmodel.MediaAttachment // processing media attachment details dataFn DataFunc // load-data function, returns media stream - postFn PostDataCallbackFunc // post data callback function recache bool // recaching existing (uncached) media done bool // done is set when process finishes with non ctx canceled type error proc runners.Processor // proc helps synchronize only a singular running processing instance err error // error stores permanent error value when done - mgr *manager // mgr instance (access to db / storage) + mgr *Manager // mgr instance (access to db / storage) } // AttachmentID returns the ID of the underlying media attachment without blocking processing. @@ -143,17 +142,6 @@ func (p *ProcessingMedia) load(ctx context.Context) (*gtsmodel.MediaAttachment, // and updates the underlying attachment fields as necessary. It will then stream // bytes from p's reader directly into storage so that it can be retrieved later. func (p *ProcessingMedia) store(ctx context.Context) error { - defer func() { - if p.postFn == nil { - return - } - - // ensure post callback gets called. - if err := p.postFn(ctx); err != nil { - log.Errorf(ctx, "error executing postdata function: %v", err) - } - }() - // Load media from provided data fun rc, sz, err := p.dataFn(ctx) if err != nil { -- cgit v1.2.3