py-libp2p/libp2p/pubsub/read_only_queue.py

15 lines
323 B
Python
Raw Normal View History

2019-04-03 10:05:14 +08:00
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]