mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
hack chat example
This commit is contained in:
@ -24,18 +24,6 @@ from libp2p.transport.upgrader import TransportUpgrader
|
||||
from libp2p.typing import TProtocol
|
||||
|
||||
|
||||
async def cleanup_done_tasks() -> None:
|
||||
"""clean up asyncio done tasks to free up resources."""
|
||||
while True:
|
||||
for task in asyncio.all_tasks():
|
||||
if task.done():
|
||||
await task
|
||||
|
||||
# Need not run often
|
||||
# Some sleep necessary to context switch
|
||||
await asyncio.sleep(3)
|
||||
|
||||
|
||||
def generate_new_rsa_identity() -> KeyPair:
|
||||
return create_new_key_pair()
|
||||
|
||||
@ -155,7 +143,4 @@ async def new_node(
|
||||
else:
|
||||
host = BasicHost(key_pair.public_key, swarm_opt)
|
||||
|
||||
# Kick off cleanup job
|
||||
asyncio.ensure_future(cleanup_done_tasks())
|
||||
|
||||
return host
|
||||
|
||||
Reference in New Issue
Block a user