Skip to content

Commit

Permalink
add 10s timeout for batch rpc call
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Jul 21, 2024
1 parent f089f48 commit fe99aa1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package robot

import (
//"context"
"context"
"errors"
"fmt"
"strconv"
Expand Down Expand Up @@ -90,7 +90,9 @@ func (m *Monitor) rpcBatchBlockByNumber(from, to uint64) ([]*types.Block, error)
}
}

if err := m.cl.BatchCall(reqs); err != nil {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := m.cl.BatchCallContext(ctx, reqs); err != nil {
return nil, err
}

Expand Down

0 comments on commit fe99aa1

Please sign in to comment.