Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
107a41e0
Unverified
Commit
107a41e0
authored
Jan 10, 2023
by
mergify[bot]
Committed by
GitHub
Jan 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4659 from ethereum-optimism/jg/rpc_timeouts
op-node: Set RPC timeouts
parents
6e71a8d8
56789460
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
rpc.go
op-node/client/rpc.go
+8
-2
No files found.
op-node/client/rpc.go
View file @
107a41e0
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"context"
"context"
"fmt"
"fmt"
"regexp"
"regexp"
"time"
"github.com/ethereum-optimism/optimism/op-service/backoff"
"github.com/ethereum-optimism/optimism/op-service/backoff"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
...
@@ -62,6 +63,7 @@ func DialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string,
...
@@ -62,6 +63,7 @@ func DialRPCClientWithBackoff(ctx context.Context, log log.Logger, addr string,
// BaseRPCClient is a wrapper around a concrete *rpc.Client instance to make it compliant
// BaseRPCClient is a wrapper around a concrete *rpc.Client instance to make it compliant
// with the client.RPC interface.
// with the client.RPC interface.
// It sets a timeout of 10s on CallContext & 20s on BatchCallContext made through it.
type
BaseRPCClient
struct
{
type
BaseRPCClient
struct
{
c
*
rpc
.
Client
c
*
rpc
.
Client
}
}
...
@@ -75,11 +77,15 @@ func (b *BaseRPCClient) Close() {
...
@@ -75,11 +77,15 @@ func (b *BaseRPCClient) Close() {
}
}
func
(
b
*
BaseRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
func
(
b
*
BaseRPCClient
)
CallContext
(
ctx
context
.
Context
,
result
any
,
method
string
,
args
...
any
)
error
{
return
b
.
c
.
CallContext
(
ctx
,
result
,
method
,
args
...
)
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
10
*
time
.
Second
)
defer
cancel
()
return
b
.
c
.
CallContext
(
cCtx
,
result
,
method
,
args
...
)
}
}
func
(
b
*
BaseRPCClient
)
BatchCallContext
(
ctx
context
.
Context
,
batch
[]
rpc
.
BatchElem
)
error
{
func
(
b
*
BaseRPCClient
)
BatchCallContext
(
ctx
context
.
Context
,
batch
[]
rpc
.
BatchElem
)
error
{
return
b
.
c
.
BatchCallContext
(
ctx
,
batch
)
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
20
*
time
.
Second
)
defer
cancel
()
return
b
.
c
.
BatchCallContext
(
cCtx
,
batch
)
}
}
func
(
b
*
BaseRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
func
(
b
*
BaseRPCClient
)
EthSubscribe
(
ctx
context
.
Context
,
channel
any
,
args
...
any
)
(
ethereum
.
Subscription
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment