summaryrefslogtreecommitdiff
path: root/internal/media/processingmedia.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-09-19 13:43:22 +0200
committerLibravatar GitHub <noreply@github.com>2022-09-19 12:43:22 +0100
commit3777f5c68448992a6ed8230f40713d3b31da0413 (patch)
tree3b56e932503b2dec6ca613e5d8abcfe074b4dfc2 /internal/media/processingmedia.go
parent[bugfix] Fix domains not being unblockable, log internal server errors from A... (diff)
downloadgotosocial-3777f5c68448992a6ed8230f40713d3b31da0413.tar.xz
[bugfix] Server and closer bugfixes (#839)
* defer streaming from storage more forcefully * shut down Server more gracefully * use command context as server BaseContext
Diffstat (limited to 'internal/media/processingmedia.go')
-rw-r--r--internal/media/processingmedia.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go
index 26fbc0cea..3f3a68f3f 100644
--- a/internal/media/processingmedia.go
+++ b/internal/media/processingmedia.go
@@ -145,9 +145,7 @@ func (p *ProcessingMedia) loadThumb(ctx context.Context) error {
return p.err
}
- // whatever happens, close the stream when we're done
defer func() {
- log.Tracef("loadThumb: closing stored stream %s", p.attachment.URL)
if err := stored.Close(); err != nil {
log.Errorf("loadThumb: error closing stored full size: %s", err)
}
@@ -210,6 +208,12 @@ func (p *ProcessingMedia) loadFullSize(ctx context.Context) error {
return p.err
}
+ defer func() {
+ if err := stored.Close(); err != nil {
+ log.Errorf("loadFullSize: error closing stored full size: %s", err)
+ }
+ }()
+
// decode the image
ct := p.attachment.File.ContentType
switch ct {
@@ -227,12 +231,6 @@ func (p *ProcessingMedia) loadFullSize(ctx context.Context) error {
return p.err
}
- if err := stored.Close(); err != nil {
- p.err = fmt.Errorf("loadFullSize: error closing stored full size: %s", err)
- atomic.StoreInt32(&p.fullSizeState, int32(errored))
- return p.err
- }
-
// set appropriate fields on the attachment based on the image we derived
p.attachment.FileMeta.Original = gtsmodel.Original{
Width: decoded.width,