Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soundboard: remove stray references to gorm #1651

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
soundboard: remove stray references to gorm
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.
jo3-l committed May 22, 2024
commit 9c92bd415b8881ba8b893aa99170a4d247cb986d
9 changes: 7 additions & 2 deletions soundboard/transcoder.go
Original file line number Diff line number Diff line change
@@ -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))