Skip to content

Commit

Permalink
Increase timeout on SELECT query to 3 mins
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Aug 29, 2024
1 parent 7f6f909 commit 0a76672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion core/chains/evm/logpoller/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ func (o *DSORM) DeleteExcessLogs(ctx context.Context, limit int64) (int64, error
limitClause = fmt.Sprintf(" ORDER BY block_number, log_index LIMIT %d", limit)
}

// Allow SELECT query to run for up to 3 minutes. DELETE query will still have default 10s timeout
selectCtx, cancel := context.WithTimeout(sqlutil.WithoutDefaultTimeout(ctx), 3*time.Minute)
defer cancel()

query := `
WITH filters AS (SELECT name,
ARRAY_AGG(address) AS addresses, ARRAY_AGG(event) AS events,
Expand All @@ -424,7 +428,7 @@ func (o *DSORM) DeleteExcessLogs(ctx context.Context, limit int64) (int64, error
(f.topic4 IS NULL OR l.topics[3] = ANY(f.topic4))
) x GROUP BY id, block_number, log_index HAVING BOOL_AND(old)` + limitClause

err := o.ds.SelectContext(ctx, &rowIds, query, ubig.New(o.chainID))
err := o.ds.SelectContext(selectCtx, &rowIds, query, ubig.New(o.chainID))
if err != nil {
return 0, err
}
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func NewOCRContractTransmitter(
Name: transmitterFilterName(address),
EventSigs: []common.Hash{transmitted.ID},
Retention: 10 * time.Minute,
Addresses: []common.Address{address}, MaxLogsKept: 0},
Addresses: []common.Address{address}, MaxLogsKept: 100000},
)
if err != nil {
return nil, err
Expand Down

0 comments on commit 0a76672

Please sign in to comment.