* refactor: ♻️ get rid of continuedev.src.continuedev structure * refactor: ♻️ switching back to server folder * feat: ✨ make config.py imports shorter * feat: 🔖 publish as pre-release vscode extension * refactor: ♻️ refactor and add more completion params to ui * build: 🏗️ download from preview S3
17 lines
597 B
Python
17 lines
597 B
Python
import asyncio
|
|
from typing import Dict
|
|
|
|
|
|
class AsyncSubscriptionQueue:
|
|
# The correct way to do this is probably to keep request IDs
|
|
queues: Dict[str, asyncio.Queue] = {}
|
|
|
|
def post(self, messageType: str, data: any):
|
|
if messageType not in self.queues:
|
|
self.queues.update({messageType: asyncio.Queue()})
|
|
self.queues[messageType].put_nowait(data)
|
|
|
|
async def get(self, message_type: str) -> any:
|
|
if message_type not in self.queues:
|
|
self.queues.update({message_type: asyncio.Queue()})
|
|
return await self.queues[message_type].get()
|