@@ -113,13 +113,23 @@ func (m *ManagedNode) SubscribeToNodeEvents() {
113113 // Resubscribe, since the RPC subscription might fail intermittently.
114114 // And fall back to polling, if RPC subscriptions are not supported.
115115 m .subscriptions = append (m .subscriptions , gethevent .ResubscribeErr (time .Second * 10 ,
116- func (ctx context.Context , _ error ) (gethevent.Subscription , error ) {
116+ func (ctx context.Context , prevErr error ) (gethevent.Subscription , error ) {
117+ if prevErr != nil {
118+ // This is the RPC runtime error, not the setup error we have logging for below.
119+ m .log .Error ("RPC subscription failed, restarting now" , "err" , prevErr )
120+ }
117121 sub , err := m .Node .SubscribeEvents (ctx , m .nodeEvents )
118122 if err != nil {
119123 if errors .Is (err , gethrpc .ErrNotificationsUnsupported ) {
124+ m .log .Warn ("No RPC notification support detected, falling back to polling" )
120125 // fallback to polling if subscriptions are not supported.
121- return rpc .StreamFallback [types.ManagedEvent ](
126+ sub , err := rpc .StreamFallback [types.ManagedEvent ](
122127 m .Node .PullEvent , time .Millisecond * 100 , m .nodeEvents )
128+ if err != nil {
129+ m .log .Error ("Failed to start RPC stream fallback" , "err" , err )
130+ return nil , err
131+ }
132+ return sub , err
123133 }
124134 return nil , err
125135 }
0 commit comments