Make peer cleanup timings smoother

master
0Gitnick 2019-11-26 18:34:10 -06:00
parent e41487f80c
commit 6f8a843e49
1 changed files with 2 additions and 4 deletions

View File

@ -41,10 +41,8 @@ def peer_cleanup():
if peerprofiles.PeerProfiles(address).score < min_score: if peerprofiles.PeerProfiles(address).score < min_score:
keydb.removekeys.remove_address(address) keydb.removekeys.remove_address(address)
try: try:
if (int(epoch.get_epoch()) - int(keydb.transportinfo.get_address_info(address, 'lastConnect'))) >= 600: lastConnect = int(keydb.transportinfo.get_address_info(address, 'lastConnect'))
expireTime = 600 expireTime = 86400 - int(epoch.get_epoch()) - lastConnect
else:
expireTime = 86400
blacklist.addToDB(address, dataType=1, expire=expireTime) blacklist.addToDB(address, dataType=1, expire=expireTime)
except sqlite3.IntegrityError: #TODO just make sure its not a unique constraint issue except sqlite3.IntegrityError: #TODO just make sure its not a unique constraint issue
pass pass