Trying another fix

This commit is contained in:
Asaf Gartner 2022-10-14 06:37:50 +03:00
parent d7f1325ace
commit 09d875a9f6
1 changed files with 8 additions and 2 deletions

View File

@ -774,7 +774,6 @@ func fetchLatestStreamStatus(ctx context.Context, conn db.ConnOrTx, twitchID str
result = &models.TwitchLatestStatus{
TwitchID: twitchID,
TwitchLogin: twitchLogin,
Tags: make([]string, 0),
}
} else if err != nil {
return nil, oops.New(err, "failed to fetch existing twitch status")
@ -815,6 +814,10 @@ func saveLatestStreamStatus(ctx context.Context, conn db.ConnOrTx, latest *model
return err
}
if latest.Tags == nil {
latest.Tags = make([]string, 0)
}
_, err = conn.Exec(ctx,
`
UPDATE twitch_latest_status
@ -874,7 +877,6 @@ func updateStreamHistory(ctx context.Context, dbConn db.ConnOrTx, status *models
if err == db.NotFound {
history = &models.TwitchStreamHistory{}
history.Tags = make([]string, 0)
history.StreamID = status.StreamID
history.TwitchID = status.TwitchID
history.TwitchLogin = status.TwitchLogin
@ -894,6 +896,10 @@ func updateStreamHistory(ctx context.Context, dbConn db.ConnOrTx, status *models
history.CategoryID = status.CategoryID
history.Tags = status.Tags
if history.Tags == nil {
history.Tags = make([]string, 0)
}
_, err = tx.Exec(ctx,
`
INSERT INTO