SQLStore: Close session in withDbSession (#31775) (#32108)

* SQLStore: Close session in withDbSession

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* SQLStore.WithDbSession: Never use session from context

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
(cherry picked from commit 5a0780801b)

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2021-03-19 10:11:26 +01:00
committed by GitHub
co-authored by Arve Knudsen
parent 5d58d0aabb
commit bc463d6a2f
8 changed files with 116 additions and 137 deletions
+1 -1
View File
@@ -510,7 +510,7 @@ func SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *models
}
func SetAlertNotificationStateToPendingCommand(ctx context.Context, cmd *models.SetAlertNotificationStateToPendingCommand) error {
return withDbSession(ctx, func(sess *DBSession) error {
return withDbSession(ctx, x, func(sess *DBSession) error {
newVersion := cmd.Version + 1
sql := `UPDATE alert_notification_state SET
state = ?,