Update gorp to support query timeouts on postgres (#6730)
* Update gorp to support query timeouts on postgres * Update help text to remove postgres exception * Fix glide.lock
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
2dea567dcf
Коммит
005dd0754b
23
vendor/github.com/mattermost/gorp/select.go
сгенерированный
поставляемый
23
vendor/github.com/mattermost/gorp/select.go
сгенерированный
поставляемый
@@ -167,15 +167,9 @@ func selectVal(e SqlExecutor, holder interface{}, query string, args ...interfac
|
||||
query, args = maybeExpandNamedQuery(dbMap, query, args)
|
||||
}
|
||||
|
||||
var rows *sql.Rows
|
||||
var err error
|
||||
if dbMap.Dialect.Name() != "PostgresDialect" {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout)
|
||||
defer cancel()
|
||||
rows, err = e.QueryContext(ctx, query, args...)
|
||||
} else {
|
||||
rows, err = e.Query(query, args...)
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), dbMap.QueryTimeout)
|
||||
defer cancel()
|
||||
rows, err := e.QueryContext(ctx, query, args...)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -267,14 +261,9 @@ func rawselect(m *DbMap, exec SqlExecutor, i interface{}, query string,
|
||||
}
|
||||
|
||||
// Run the query
|
||||
var rows *sql.Rows
|
||||
if m.Dialect.Name() != "PostgresDialect" {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout)
|
||||
defer cancel()
|
||||
rows, err = exec.QueryContext(ctx, query, args...)
|
||||
} else {
|
||||
rows, err = exec.Query(query, args...)
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), m.QueryTimeout)
|
||||
defer cancel()
|
||||
rows, err := exec.QueryContext(ctx, query, args...)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Ссылка в новой задаче
Block a user