mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
QSP-42 Remove Double Unsubscribe in Initial Sync (#6368)
* rem double unsub * Update beacon-chain/sync/initial-sync/service.go Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com> * Merge refs/heads/master into qsp-unsub * Merge refs/heads/master into qsp-unsub * Merge refs/heads/master into qsp-unsub * Merge refs/heads/master into qsp-unsub * Merge refs/heads/master into qsp-unsub
This commit is contained in:
parent
c3adde3b32
commit
637354f037
@ -80,9 +80,7 @@ func (s *Service) Start() {
|
|||||||
// Wait for state to be initialized.
|
// Wait for state to be initialized.
|
||||||
stateChannel := make(chan *feed.Event, 1)
|
stateChannel := make(chan *feed.Event, 1)
|
||||||
stateSub := s.stateNotifier.StateFeed().Subscribe(stateChannel)
|
stateSub := s.stateNotifier.StateFeed().Subscribe(stateChannel)
|
||||||
defer stateSub.Unsubscribe()
|
for genesisSet := false; !genesisSet; {
|
||||||
genesisSet := false
|
|
||||||
for !genesisSet {
|
|
||||||
select {
|
select {
|
||||||
case event := <-stateChannel:
|
case event := <-stateChannel:
|
||||||
if event.Type == statefeed.Initialized {
|
if event.Type == statefeed.Initialized {
|
||||||
@ -97,10 +95,10 @@ func (s *Service) Start() {
|
|||||||
}
|
}
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
log.Debug("Context closed, exiting goroutine")
|
log.Debug("Context closed, exiting goroutine")
|
||||||
return
|
break
|
||||||
case err := <-stateSub.Err():
|
case err := <-stateSub.Err():
|
||||||
log.WithError(err).Error("Subscription to state notifier failed")
|
log.WithError(err).Error("Subscription to state notifier failed")
|
||||||
return
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stateSub.Unsubscribe()
|
stateSub.Unsubscribe()
|
||||||
|
Loading…
Reference in New Issue
Block a user