Use latest added peers and use reputation for listModifications and publishing
This commit is contained in:
parent
2188c5d9fa
commit
0f8de2b7c1
1 changed files with 6 additions and 0 deletions
|
@ -926,6 +926,12 @@ class Site(object):
|
|||
|
||||
return found
|
||||
|
||||
# Return: Recently found peers
|
||||
def getRecentPeers(self, need_num):
|
||||
found = sorted(self.peers.values()[0:need_num*50], key=lambda peer: peer.time_found + peer.reputation * 60, reverse=True)[0:need_num*2]
|
||||
random.shuffle(found)
|
||||
return found[0:need_num]
|
||||
|
||||
def getConnectedPeers(self):
|
||||
return [peer for peer in self.peers.values() if peer.connection and peer.connection.connected]
|
||||
|
||||
|
|
Loading…
Reference in a new issue