[MM-13799] Avoid queries timing out during upgrade (#17444)
* Avoid timing out during upgrade * Update gorp dep Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
93c8c6e9d8
Коммит
3984381011
11
vendor/github.com/mattermost/gorp/column.go
сгенерированный
поставляемый
11
vendor/github.com/mattermost/gorp/column.go
сгенерированный
поставляемый
@@ -28,6 +28,10 @@ type ColumnMap struct {
|
||||
// Not used elsewhere
|
||||
Unique bool
|
||||
|
||||
// If not nil, " default 'value'" is added to the create table statements.
|
||||
// Not used elsewhere
|
||||
DefaultConstraint *string
|
||||
|
||||
// Query used for getting generated id after insert
|
||||
GeneratedIdQuery string
|
||||
|
||||
@@ -81,3 +85,10 @@ func (c *ColumnMap) SetMaxSize(size int) *ColumnMap {
|
||||
c.MaxSize = size
|
||||
return c
|
||||
}
|
||||
|
||||
// SetDefaultConstraint adds " default 'value'" to the create table statements for this
|
||||
// column, if value is not nil. Not used elsewhere
|
||||
func (c *ColumnMap) SetDefaultConstraint(value *string) *ColumnMap {
|
||||
c.DefaultConstraint = value
|
||||
return c
|
||||
}
|
||||
|
||||
10
vendor/github.com/mattermost/gorp/gorp.go
сгенерированный
поставляемый
10
vendor/github.com/mattermost/gorp/gorp.go
сгенерированный
поставляемый
@@ -173,9 +173,13 @@ func exec(e SqlExecutor, query string, doTimeout bool, args ...interface{}) (sql
|
||||
query, args = maybeExpandNamedQuery(dbMap, query, args)
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout)
|
||||
defer cancel()
|
||||
return executor.ExecContext(ctx, query, args...)
|
||||
if doTimeout {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout)
|
||||
defer cancel()
|
||||
return executor.ExecContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
return executor.Exec(query, args...)
|
||||
}
|
||||
|
||||
// maybeExpandNamedQuery checks the given arg to see if it's eligible to be used
|
||||
|
||||
3
vendor/github.com/mattermost/gorp/table.go
сгенерированный
поставляемый
3
vendor/github.com/mattermost/gorp/table.go
сгенерированный
поставляемый
@@ -221,6 +221,9 @@ func (t *TableMap) SqlForCreate(ifNotExists bool) string {
|
||||
if col.isPK || col.isNotNull {
|
||||
s.WriteString(" not null")
|
||||
}
|
||||
if col.DefaultConstraint != nil {
|
||||
s.WriteString(fmt.Sprintf(" default '%s'", *col.DefaultConstraint))
|
||||
}
|
||||
if col.isPK && len(t.keys) == 1 {
|
||||
s.WriteString(" primary key")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user