From 8877a03e73d63e69c2b5f82dc35120099aac551b Mon Sep 17 00:00:00 2001 From: Joe L <56809242+jo3-l@users.noreply.github.com> Date: Tue, 28 May 2024 03:02:11 -0700 Subject: [PATCH] soundboard: remove stray references to gorm (#1651) 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. --- soundboard/transcoder.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/soundboard/transcoder.go b/soundboard/transcoder.go index cc100581df..810d605d6e 100644 --- a/soundboard/transcoder.go +++ b/soundboard/transcoder.go @@ -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" ) @@ -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))