mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 11:42:24 -05:00
[chore] close in-storage media reader _before_ opening write, no need to leave it hanging around (#1016)
Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
b755906ad1
commit
3ce0e33f99
2 changed files with 13 additions and 16 deletions
|
|
@ -148,12 +148,7 @@ func (p *ProcessingEmoji) loadStatic(ctx context.Context) error {
|
|||
atomic.StoreInt32(&p.staticState, int32(errored))
|
||||
return p.err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err := stored.Close(); err != nil {
|
||||
log.Errorf("loadStatic: error closing stored full size: %s", err)
|
||||
}
|
||||
}()
|
||||
defer stored.Close()
|
||||
|
||||
// we haven't processed a static version of this emoji yet so do it now
|
||||
static, err := deriveStaticEmoji(stored, p.emoji.ImageContentType)
|
||||
|
|
@ -163,7 +158,12 @@ func (p *ProcessingEmoji) loadStatic(ctx context.Context) error {
|
|||
return p.err
|
||||
}
|
||||
|
||||
// put the static in storage
|
||||
// Close stored emoji now we're done
|
||||
if err := stored.Close(); err != nil {
|
||||
log.Errorf("loadStatic: error closing stored full size: %s", err)
|
||||
}
|
||||
|
||||
// put the static image in storage
|
||||
if err := p.storage.Put(ctx, p.emoji.ImageStaticPath, static.small); err != nil && err != storage.ErrAlreadyExists {
|
||||
p.err = fmt.Errorf("loadStatic: error storing static: %s", err)
|
||||
atomic.StoreInt32(&p.staticState, int32(errored))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue