mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 08:57:29 -06:00
[bugfix] Server and closer bugfixes (#839)
* defer streaming from storage more forcefully * shut down Server more gracefully * use command context as server BaseContext
This commit is contained in:
parent
c1585d5f8a
commit
3777f5c684
4 changed files with 47 additions and 29 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue