diff options
author | 2023-05-28 13:08:35 +0100 | |
---|---|---|
committer | 2023-05-28 14:08:35 +0200 | |
commit | 5faeb4de2032e112ab49751eeeb906ac43826f3d (patch) | |
tree | ea94b86f27384954ff93aec864b13b83c7f46db0 /internal/media/processingemoji.go | |
parent | [docs] Update + simplify roadmap, revise beta estimate (#1826) (diff) | |
download | gotosocial-5faeb4de2032e112ab49751eeeb906ac43826f3d.tar.xz |
[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 <grufwub@gmail.com>
* remove last traces of media.Manager being an interface
Signed-off-by: kim <grufwub@gmail.com>
* update error to provide caller, allow tuneable via build tags
Signed-off-by: kim <grufwub@gmail.com>
* remove kim-specific build script changes
Signed-off-by: kim <grufwub@gmail.com>
* fix merge conflicts
Signed-off-by: kim <grufwub@gmail.com>
* update build-script to support externally setting build variables
Signed-off-by: kim <grufwub@gmail.com>
---------
Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/media/processingemoji.go')
-rw-r--r-- | internal/media/processingemoji.go | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/internal/media/processingemoji.go b/internal/media/processingemoji.go index b2da54289..7c3db8196 100644 --- a/internal/media/processingemoji.go +++ b/internal/media/processingemoji.go @@ -36,16 +36,15 @@ import ( // ProcessingEmoji represents an emoji currently processing. It exposes // various functions for retrieving data from the process. type ProcessingEmoji struct { - instAccID string // instance account ID - emoji *gtsmodel.Emoji // processing emoji details - refresh bool // whether this is an existing emoji being refreshed - newPathID string // new emoji path ID to use if refreshed - dataFn DataFunc // load-data function, returns media stream - postFn PostDataCallbackFunc // post data callback function - 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) + instAccID string // instance account ID + emoji *gtsmodel.Emoji // processing emoji details + refresh bool // whether this is an existing emoji being refreshed + newPathID string // new emoji path ID to use if refreshed + dataFn DataFunc // load-data function, returns media stream + 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) } // EmojiID returns the ID of the underlying emoji without blocking processing. @@ -158,17 +157,6 @@ func (p *ProcessingEmoji) load(ctx context.Context) (*gtsmodel.Emoji, bool, erro // 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 *ProcessingEmoji) 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 fn. rc, sz, err := p.dataFn(ctx) if err != nil { |