Skip to content

Commit

Permalink
Prioritize stale peer connections
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Jun 26, 2021
1 parent 09eea19 commit 2130af3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ func (n *Node) jobUpdateSessions() error {

remove, skip := func() (bool, bool) {
switch {
case items[i].Download == session.Bandwidth.Upload.Int64() && items[i].ConnectedAt.Before(session.StatusAt):
n.Log().Info("Stale peer connection", "id", items[i].ID)
return true, true
case !subscription.Status.Equal(hubtypes.StatusActive):
n.Log().Info("Invalid subscription status", "id", items[i].ID)
return true, subscription.Status.Equal(hubtypes.StatusInactive)
case !session.Status.Equal(hubtypes.StatusActive):
n.Log().Info("Invalid session status", "id", items[i].ID)
return true, session.Status.Equal(hubtypes.StatusInactive)
case items[i].Download == session.Bandwidth.Upload.Int64() && items[i].ConnectedAt.Before(session.StatusAt):
n.Log().Info("Stale peer connection", "id", items[i].ID)
return true, false
default:
return false, false
}
Expand Down

0 comments on commit 2130af3

Please sign in to comment.