MCPcopy Create free account
hub / github.com/ethstorage/es-node / update

Method update

ethstorage/scanner/scanner.go:67–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67func (s *Scanner) update() {
68 defer s.wg.Done()
69 syncEventCh := make(chan protocol.EthStorageSyncDone)
70 sub := s.feed.Subscribe(syncEventCh)
71 defer func() {
72 sub.Unsubscribe()
73 close(syncEventCh)
74 s.lg.Debug("Scanner event subscription closed")
75 }()
76
77 for {
78 s.lg.Debug("Scanner update loop")
79 select {
80 case syncDone, ok := <-syncEventCh:
81 if !ok {
82 s.lg.Debug("syncEventCh closed, exiting update loop")
83 return
84 }
85 if syncDone.DoneType == protocol.AllShardDone {
86 s.lg.Info("Scanner update loop received event - all shards done.")
87 s.start()
88 return
89 }
90 case <-s.ctx.Done():
91 return
92 }
93 }
94}
95
96func (s *Scanner) start() {
97 s.mu.Lock()

Callers 1

StartMethod · 0.95

Calls 1

startMethod · 0.95

Tested by

no test coverage detected