-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: storenode cycle #1223
base: master
Are you sure you want to change the base?
feat: storenode cycle #1223
Conversation
d9361e5
to
3988fc6
Compare
s.Lock() | ||
defer s.Unlock() | ||
|
||
for _, subs := range s.subscriptions { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be sub
.
m.host = h | ||
m.failedRequests = make(map[peer.ID]uint) | ||
m.peers = make(map[peer.ID]peerStatus) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we connect the store node first with some strategy before actually verify the status?
} else { | ||
m.peers[m.activeStorenode] = peerStatus{ | ||
status: disconnected, | ||
canConnectAfter: time.Now().Add(backoffDuration), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another strategy is have a blacklist of unreachable store nodes, and periodically check if the node should be kept in the list.
m.logger.Info("Automatically switching storenode") | ||
|
||
if m.activeStorenode != "" { | ||
m.disconnectActiveStorenode(graylistBackoff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why this is needed and the intention of this graylistBackoff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. Looking at the existing code in status-go, i believe it is so we dont connect again to this storenode for 3 minutes.
waku/v2/api/history/cycle.go
Outdated
} | ||
|
||
func (m *StorenodeCycle) verifyStorenodeStatus(ctx context.Context) { | ||
ticker := time.NewTicker(1 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be a constant.
b2d0226
to
b852a92
Compare
b852a92
to
f29ce5f
Compare
This PR contains the storenode cycle code from status-go.
I tried to simplify it a bit but most of the heavy refactoring should be done on a separate PR since this one is already complex enough.
@plopezlpz, @kaichaosun @igor-sirotin @chaitanyaprem:
I'm still working on the unit tests, but so far, while testing status-im/status-go#5857 with Desktop, it looks promising. Reviews are appreciated!