mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Ignoring primary key duplication errors on status saveorupdate (#7255)
This commit is contained in:
committed by
Corey Hulen
parent
17098fb2a3
commit
2461c55d0d
@@ -6,6 +6,7 @@ package store
|
||||
import (
|
||||
"database/sql"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/platform/model"
|
||||
)
|
||||
@@ -48,7 +49,9 @@ func (s SqlStatusStore) SaveOrUpdate(status *model.Status) StoreChannel {
|
||||
}
|
||||
} else {
|
||||
if err := s.GetMaster().Insert(status); err != nil {
|
||||
result.Err = model.NewLocAppError("SqlStatusStore.SaveOrUpdate", "store.sql_status.save.app_error", nil, err.Error())
|
||||
if !(strings.Contains(err.Error(), "for key 'PRIMARY'") && strings.Contains(err.Error(), "Duplicate entry")) {
|
||||
result.Err = model.NewLocAppError("SqlStatusStore.SaveOrUpdate", "store.sql_status.save.app_error", nil, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user