Fix handling full que exception

This commit is contained in:
taizan-hokuto
2020-03-07 22:16:46 +09:00
parent 55a58f532d
commit 1074178afc
2 changed files with 15 additions and 1 deletions

View File

@@ -20,6 +20,13 @@ class Buffer(asyncio.Queue):
super().get_nowait()
await super().put(item)
def put_nowait(self,item):
if item is None:
return
if super().full():
super().get_nowait()
super().put_nowait(item)
async def get(self):
ret = []
ret.append(await super().get())

View File

@@ -22,6 +22,13 @@ class Buffer(queue.Queue):
else:
super().put(item)
def put_nowait(self,item):
if item is None:
return
if super().full():
super().get_nowait()
else:
super().put_nowait(item)
def get(self):
ret = []