Skip to content

Commit

Permalink
soundboard: remove stray references to gorm (#1651)
Browse files Browse the repository at this point in the history
The soundboard module used to use gorm, but was migrated to sqlboiler some years ago in commit 628ea9a. There are still two (erroneous) references to gorm remaining which were not caught since this section of code ignores errors. This commit changes these to use sqlboiler as well.
  • Loading branch information
jo3-l authored May 28, 2024
1 parent 5813655 commit 8877a03
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions soundboard/transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/botlabs-gg/yagpdb/v2/common/backgroundworkers"
"github.com/botlabs-gg/yagpdb/v2/lib/dca"
"github.com/botlabs-gg/yagpdb/v2/soundboard/models"
"github.com/volatiletech/sqlboiler/v4/boil"
"goji.io/pat"
)

Expand Down Expand Up @@ -120,10 +121,14 @@ func handleQueueItem(item string) error {
err = transcodeSound(sound)
if err != nil {
logger.WithError(err).WithField("sound", sound.ID).Error("Failed transcoding sound")
common.GORM.Model(&sound).Update("Status", TranscodingStatusFailedOther)

sound.Status = int(TranscodingStatusFailedOther)
sound.UpdateG(context.Background(), boil.Whitelist("status"))

os.Remove(SoundFilePath(sound.ID, TranscodingStatusReady))
} else {
common.GORM.Model(&sound).Update("Status", TranscodingStatusReady)
sound.Status = int(TranscodingStatusReady)
sound.UpdateG(context.Background(), boil.Whitelist("status"))
}

err = os.Remove(SoundFilePath(sound.ID, TranscodingStatusQueued))
Expand Down

0 comments on commit 8877a03

Please sign in to comment.