feat: extend context timeout to 1 minute for database queries in mssql.go and postgres.go
This commit is contained in:
@@ -184,7 +184,7 @@ JOIN sys.partitions p ON t.object_id = p.object_id
|
|||||||
WHERE s.name = @schema AND t.name = @table AND p.index_id IN (0, 1)
|
WHERE s.name = @schema AND t.name = @table AND p.index_id IN (0, 1)
|
||||||
GROUP BY t.name`
|
GROUP BY t.name`
|
||||||
|
|
||||||
ctxTimeout, cancel := context.WithTimeout(ctx, time.Second*20)
|
ctxTimeout, cancel := context.WithTimeout(ctx, 1*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
var rowsCount int64
|
var rowsCount int64
|
||||||
@@ -216,7 +216,7 @@ ORDER BY batch_id`,
|
|||||||
tableInfo.Schema,
|
tableInfo.Schema,
|
||||||
tableInfo.Table)
|
tableInfo.Table)
|
||||||
|
|
||||||
ctxTimeout, cancel := context.WithTimeout(ctx, time.Second*20)
|
ctxTimeout, cancel := context.WithTimeout(ctx, 1*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
rows, err := ta.db.Query(ctxTimeout, query, sql.Named("maxPartitions", maxPartitions))
|
rows, err := ta.db.Query(ctxTimeout, query, sql.Named("maxPartitions", maxPartitions))
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ func (ta *PostgresTableAnalyzer) QueryColumnTypes(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
tableInfo config.TableInfo,
|
tableInfo config.TableInfo,
|
||||||
) ([]models.ColumnType, error) {
|
) ([]models.ColumnType, error) {
|
||||||
localCtx, cancel := context.WithTimeout(ctx, 20*time.Second)
|
localCtx, cancel := context.WithTimeout(ctx, 1*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
rows, err := ta.db.Query(localCtx, postgresColumnMetadataQuery, tableInfo.Schema, tableInfo.Table)
|
rows, err := ta.db.Query(localCtx, postgresColumnMetadataQuery, tableInfo.Schema, tableInfo.Table)
|
||||||
|
|||||||
Reference in New Issue
Block a user