File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ async def run(port: int, destination: str) -> None:
59
59
host = new_host (listen_addrs = [listen_addr ])
60
60
61
61
async with host .run (listen_addrs = [listen_addr ]), trio .open_nursery () as nursery :
62
+ # Start the peer-store cleanup task
63
+ nursery .start_soon (host .get_peerstore ().start_cleanup_task , 60 )
64
+
62
65
if not destination :
63
66
host .set_stream_handler (PING_PROTOCOL_ID , handle_ping )
64
67
Original file line number Diff line number Diff line change @@ -1327,6 +1327,10 @@ def peer_ids(self) -> list[ID]:
1327
1327
def clear_peerdata (self , peer_id : ID ) -> None :
1328
1328
"""clear_peerdata"""
1329
1329
1330
+ @abstractmethod
1331
+ async def start_cleanup_task (self , cleanup_interval : int = 3600 ) -> None :
1332
+ """Start periodic cleanup of expired peer records and addresses."""
1333
+
1330
1334
1331
1335
# -------------------------- listener interface.py --------------------------
1332
1336
You can’t perform that action at this time.
0 commit comments