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
5f7e31ce
Unverified
Commit
5f7e31ce
authored
Jan 14, 2025
by
protolambda
Committed by
GitHub
Jan 14, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-supervisor: add logging for RPC subscription state changes (#13632)
parent
709e1bf9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
node.go
op-supervisor/supervisor/backend/syncnode/node.go
+12
-2
No files found.
op-supervisor/supervisor/backend/syncnode/node.go
View file @
5f7e31ce
...
@@ -113,13 +113,23 @@ func (m *ManagedNode) SubscribeToNodeEvents() {
...
@@ -113,13 +113,23 @@ func (m *ManagedNode) SubscribeToNodeEvents() {
// Resubscribe, since the RPC subscription might fail intermittently.
// Resubscribe, since the RPC subscription might fail intermittently.
// And fall back to polling, if RPC subscriptions are not supported.
// And fall back to polling, if RPC subscriptions are not supported.
m
.
subscriptions
=
append
(
m
.
subscriptions
,
gethevent
.
ResubscribeErr
(
time
.
Second
*
10
,
m
.
subscriptions
=
append
(
m
.
subscriptions
,
gethevent
.
ResubscribeErr
(
time
.
Second
*
10
,
func
(
ctx
context
.
Context
,
_
error
)
(
gethevent
.
Subscription
,
error
)
{
func
(
ctx
context
.
Context
,
prevErr
error
)
(
gethevent
.
Subscription
,
error
)
{
if
prevErr
!=
nil
{
// This is the RPC runtime error, not the setup error we have logging for below.
m
.
log
.
Error
(
"RPC subscription failed, restarting now"
,
"err"
,
prevErr
)
}
sub
,
err
:=
m
.
Node
.
SubscribeEvents
(
ctx
,
m
.
nodeEvents
)
sub
,
err
:=
m
.
Node
.
SubscribeEvents
(
ctx
,
m
.
nodeEvents
)
if
err
!=
nil
{
if
err
!=
nil
{
if
errors
.
Is
(
err
,
gethrpc
.
ErrNotificationsUnsupported
)
{
if
errors
.
Is
(
err
,
gethrpc
.
ErrNotificationsUnsupported
)
{
m
.
log
.
Warn
(
"No RPC notification support detected, falling back to polling"
)
// fallback to polling if subscriptions are not supported.
// fallback to polling if subscriptions are not supported.
return
rpc
.
StreamFallback
[
types
.
ManagedEvent
](
sub
,
err
:=
rpc
.
StreamFallback
[
types
.
ManagedEvent
](
m
.
Node
.
PullEvent
,
time
.
Millisecond
*
100
,
m
.
nodeEvents
)
m
.
Node
.
PullEvent
,
time
.
Millisecond
*
100
,
m
.
nodeEvents
)
if
err
!=
nil
{
m
.
log
.
Error
(
"Failed to start RPC stream fallback"
,
"err"
,
err
)
return
nil
,
err
}
return
sub
,
err
}
}
return
nil
,
err
return
nil
,
err
}
}
...
...
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