mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Add priority queues to handle seqno
This commit is contained in:
14
libp2p/pubsub/read_only_queue.py
Normal file
14
libp2p/pubsub/read_only_queue.py
Normal file
@ -0,0 +1,14 @@
|
||||
import asyncio
|
||||
|
||||
class ReadOnlyQueue():
|
||||
|
||||
def __init__(self, queue):
|
||||
self.queue = queue
|
||||
|
||||
async def get(self):
|
||||
"""
|
||||
Get the next item from queue, which has items in the format (priority, data)
|
||||
:return: next item from the queue
|
||||
"""
|
||||
return (await self.queue.get())[1]
|
||||
|
||||
Reference in New Issue
Block a user