Skip to content

Commit de1de8a

Browse files
committed
initialize update chan before using it
1 parent 0a6d26d commit de1de8a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

pkg/events/events.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ type Processor struct {
7575

7676
func NewProcessor(sub substrate.Manager, cb Callback, state State) *Processor {
7777
return &Processor{
78-
sub: sub,
79-
cb: cb,
80-
state: state,
78+
update: make(chan substrate.Manager, 0),
79+
sub: sub,
80+
cb: cb,
81+
state: state,
8182
}
8283
}
8384

@@ -178,7 +179,8 @@ func (e *Processor) subscribe(ctx context.Context) error {
178179
// if new update is received then the connection is broken as noded only issues new update only if
179180
// the old manager is broken so we need to resubscribe with the new manager.
180181
e.sub = newSub
181-
return errors.New("new substrate manager received, trying to resubscribe to the new manager")
182+
log.Info().Msg("new substrate manager received, trying to resubscribe to the new manager")
183+
return errors.New("failed to listen to substrate events")
182184
}
183185
}
184186
}

0 commit comments

Comments
 (0)